From 3729c5fd3c360ed99b59c2d12341257476cbd174 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 29 Mar 2018 14:57:19 -0700 Subject: [PATCH 01/14] Generated from b48e884abf37b969e12fd673c7b88e620346d635 (#2601) Fix regression in tag --- lib/services/monitor/lib/LICENSE.txt | 21 + lib/services/monitor/lib/lib/models/action.js | 67 + .../monitor/lib/lib/models/actionGroupList.js | 61 + .../lib/lib/models/actionGroupPatchBody.js | 70 + .../lib/lib/models/actionGroupResource.js | 269 ++ .../lib/models/activityLogAlertActionGroup.js | 70 + .../lib/models/activityLogAlertActionList.js | 62 + .../models/activityLogAlertAllOfCondition.js | 63 + .../models/activityLogAlertLeafCondition.js | 66 + .../lib/lib/models/activityLogAlertList.js | 61 + .../lib/models/activityLogAlertPatchBody.js | 70 + .../lib/models/activityLogAlertResource.js | 153 + .../lib/lib/models/alertRuleResource.js | 175 + .../lib/models/alertRuleResourceCollection.js | 59 + .../lib/lib/models/alertRuleResourcePatch.js | 143 + .../lib/models/automationRunbookReceiver.js | 95 + .../lib/lib/models/autoscaleNotification.js | 86 + .../lib/lib/models/autoscaleProfile.js | 204 + .../lib/models/autoscaleSettingResource.js | 159 + .../autoscaleSettingResourceCollection.js | 67 + .../models/autoscaleSettingResourcePatch.js | 126 + .../lib/lib/models/azureAppPushReceiver.js | 62 + .../lib/lib/models/azureFunctionReceiver.js | 79 + .../monitor/lib/lib/models/baseline.js | 84 + .../lib/lib/models/baselineMetadataValue.js | 65 + .../lib/lib/models/baselineResponse.js | 154 + .../lib/models/calculateBaselineResponse.js | 85 + .../diagnosticSettingsCategoryResource.js | 82 + ...osticSettingsCategoryResourceCollection.js | 63 + .../lib/models/diagnosticSettingsResource.js | 142 + .../diagnosticSettingsResourceCollection.js | 62 + .../lib/lib/models/emailNotification.js | 78 + .../monitor/lib/lib/models/emailReceiver.js | 72 + .../monitor/lib/lib/models/enableRequest.js | 52 + .../monitor/lib/lib/models/errorResponse.js | 61 + .../lib/lib/models/eventCategoryCollection.js | 60 + .../monitor/lib/lib/models/eventData.js | 342 ++ .../lib/lib/models/eventDataCollection.js | 68 + .../monitor/lib/lib/models/httpRequestInfo.js | 76 + .../monitor/lib/lib/models/incident.js | 93 + .../lib/lib/models/incidentListResult.js | 59 + .../monitor/lib/lib/models/index.d.ts | 2298 +++++++++ lib/services/monitor/lib/lib/models/index.js | 131 + .../monitor/lib/lib/models/itsmReceiver.js | 89 + .../lib/lib/models/localizableString.js | 60 + .../models/locationThresholdRuleCondition.js | 96 + .../lib/lib/models/logProfileCollection.js | 59 + .../lib/lib/models/logProfileResource.js | 161 + .../lib/lib/models/logProfileResourcePatch.js | 129 + .../monitor/lib/lib/models/logSettings.js | 79 + .../lib/lib/models/logicAppReceiver.js | 70 + .../managementEventAggregationCondition.js | 73 + .../models/managementEventRuleCondition.js | 94 + .../monitor/lib/lib/models/metadataValue.js | 65 + lib/services/monitor/lib/lib/models/metric.js | 102 + .../lib/lib/models/metricAlertCriteria.js | 70 + .../lib/lib/models/metricAlertResource.js | 208 + .../models/metricAlertResourceCollection.js | 59 + .../lib/models/metricAlertResourcePatch.js | 176 + ...ertSingleResourceMultipleMetricCriteria.js | 79 + .../lib/lib/models/metricAlertStatus.js | 84 + .../lib/models/metricAlertStatusCollection.js | 62 + .../lib/models/metricAlertStatusProperties.js | 75 + .../lib/lib/models/metricAvailability.js | 64 + .../monitor/lib/lib/models/metricCriteria.js | 110 + .../lib/lib/models/metricDefinition.js | 165 + .../lib/models/metricDefinitionCollection.js | 59 + .../monitor/lib/lib/models/metricDimension.js | 74 + .../monitor/lib/lib/models/metricSettings.js | 89 + .../monitor/lib/lib/models/metricTrigger.js | 125 + .../monitor/lib/lib/models/metricValue.js | 95 + .../monitor/lib/lib/models/operation.js | 68 + .../lib/lib/models/operationDisplay.js | 69 + .../lib/lib/models/operationListResult.js | 73 + .../lib/lib/models/proxyOnlyResource.js | 75 + .../monitor/lib/lib/models/recurrence.js | 114 + .../lib/lib/models/recurrentSchedule.js | 138 + .../monitor/lib/lib/models/resource.js | 98 + .../monitor/lib/lib/models/response.js | 113 + .../monitor/lib/lib/models/retentionPolicy.js | 65 + .../monitor/lib/lib/models/ruleAction.js | 59 + .../monitor/lib/lib/models/ruleCondition.js | 80 + .../monitor/lib/lib/models/ruleDataSource.js | 68 + .../monitor/lib/lib/models/ruleEmailAction.js | 88 + .../ruleManagementEventClaimsDataSource.js | 52 + .../models/ruleManagementEventDataSource.js | 145 + .../lib/lib/models/ruleMetricDataSource.js | 78 + .../lib/lib/models/ruleWebhookAction.js | 88 + .../monitor/lib/lib/models/scaleAction.js | 87 + .../monitor/lib/lib/models/scaleCapacity.js | 72 + .../monitor/lib/lib/models/scaleRule.js | 102 + .../lib/lib/models/senderAuthorization.js | 72 + .../monitor/lib/lib/models/smsReceiver.js | 80 + .../lib/lib/models/thresholdRuleCondition.js | 115 + .../lib/lib/models/timeSeriesElement.js | 81 + .../lib/lib/models/timeSeriesInformation.js | 90 + .../monitor/lib/lib/models/timeWindow.js | 105 + .../monitor/lib/lib/models/voiceReceiver.js | 69 + .../lib/lib/models/webhookNotification.js | 69 + .../monitor/lib/lib/models/webhookReceiver.js | 61 + .../lib/lib/monitorManagementClient.d.ts | 76 + .../lib/lib/monitorManagementClient.js | 100 + .../lib/lib/operations/actionGroups.js | 1810 +++++++ .../lib/lib/operations/activityLogAlerts.js | 1543 ++++++ .../lib/lib/operations/activityLogs.js | 545 +++ .../lib/lib/operations/alertRuleIncidents.js | 500 ++ .../monitor/lib/lib/operations/alertRules.js | 1423 ++++++ .../lib/lib/operations/autoscaleSettings.js | 1561 ++++++ .../diagnosticSettingsCategoryOperations.js | 479 ++ .../diagnosticSettingsOperations.js | 991 ++++ .../lib/lib/operations/eventCategories.js | 244 + .../monitor/lib/lib/operations/index.d.ts | 4284 +++++++++++++++++ .../monitor/lib/lib/operations/index.js | 33 + .../monitor/lib/lib/operations/logProfiles.js | 1319 +++++ .../lib/lib/operations/metricAlerts.js | 1590 ++++++ .../lib/lib/operations/metricAlertsStatus.js | 505 ++ .../lib/lib/operations/metricBaseline.js | 642 +++ .../lib/lib/operations/metricDefinitions.js | 264 + .../monitor/lib/lib/operations/metrics.js | 430 ++ .../monitor/lib/lib/operations/operations.js | 235 + .../lib/lib/operations/tenantActivityLogs.js | 565 +++ lib/services/monitor/lib/package.json | 22 + 122 files changed, 30721 insertions(+) create mode 100644 lib/services/monitor/lib/LICENSE.txt create mode 100644 lib/services/monitor/lib/lib/models/action.js create mode 100644 lib/services/monitor/lib/lib/models/actionGroupList.js create mode 100644 lib/services/monitor/lib/lib/models/actionGroupPatchBody.js create mode 100644 lib/services/monitor/lib/lib/models/actionGroupResource.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionList.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertList.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertResource.js create mode 100644 lib/services/monitor/lib/lib/models/alertRuleResource.js create mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/automationRunbookReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleNotification.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleProfile.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResource.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/azureAppPushReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/azureFunctionReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/baseline.js create mode 100644 lib/services/monitor/lib/lib/models/baselineMetadataValue.js create mode 100644 lib/services/monitor/lib/lib/models/baselineResponse.js create mode 100644 lib/services/monitor/lib/lib/models/calculateBaselineResponse.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/emailNotification.js create mode 100644 lib/services/monitor/lib/lib/models/emailReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/enableRequest.js create mode 100644 lib/services/monitor/lib/lib/models/errorResponse.js create mode 100644 lib/services/monitor/lib/lib/models/eventCategoryCollection.js create mode 100644 lib/services/monitor/lib/lib/models/eventData.js create mode 100644 lib/services/monitor/lib/lib/models/eventDataCollection.js create mode 100644 lib/services/monitor/lib/lib/models/httpRequestInfo.js create mode 100644 lib/services/monitor/lib/lib/models/incident.js create mode 100644 lib/services/monitor/lib/lib/models/incidentListResult.js create mode 100644 lib/services/monitor/lib/lib/models/index.d.ts create mode 100644 lib/services/monitor/lib/lib/models/index.js create mode 100644 lib/services/monitor/lib/lib/models/itsmReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/localizableString.js create mode 100644 lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/logProfileCollection.js create mode 100644 lib/services/monitor/lib/lib/models/logProfileResource.js create mode 100644 lib/services/monitor/lib/lib/models/logProfileResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/logSettings.js create mode 100644 lib/services/monitor/lib/lib/models/logicAppReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js create mode 100644 lib/services/monitor/lib/lib/models/managementEventRuleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/metadataValue.js create mode 100644 lib/services/monitor/lib/lib/models/metric.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertCriteria.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertResource.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatus.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js create mode 100644 lib/services/monitor/lib/lib/models/metricAvailability.js create mode 100644 lib/services/monitor/lib/lib/models/metricCriteria.js create mode 100644 lib/services/monitor/lib/lib/models/metricDefinition.js create mode 100644 lib/services/monitor/lib/lib/models/metricDefinitionCollection.js create mode 100644 lib/services/monitor/lib/lib/models/metricDimension.js create mode 100644 lib/services/monitor/lib/lib/models/metricSettings.js create mode 100644 lib/services/monitor/lib/lib/models/metricTrigger.js create mode 100644 lib/services/monitor/lib/lib/models/metricValue.js create mode 100644 lib/services/monitor/lib/lib/models/operation.js create mode 100644 lib/services/monitor/lib/lib/models/operationDisplay.js create mode 100644 lib/services/monitor/lib/lib/models/operationListResult.js create mode 100644 lib/services/monitor/lib/lib/models/proxyOnlyResource.js create mode 100644 lib/services/monitor/lib/lib/models/recurrence.js create mode 100644 lib/services/monitor/lib/lib/models/recurrentSchedule.js create mode 100644 lib/services/monitor/lib/lib/models/resource.js create mode 100644 lib/services/monitor/lib/lib/models/response.js create mode 100644 lib/services/monitor/lib/lib/models/retentionPolicy.js create mode 100644 lib/services/monitor/lib/lib/models/ruleAction.js create mode 100644 lib/services/monitor/lib/lib/models/ruleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/ruleDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleEmailAction.js create mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleMetricDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleWebhookAction.js create mode 100644 lib/services/monitor/lib/lib/models/scaleAction.js create mode 100644 lib/services/monitor/lib/lib/models/scaleCapacity.js create mode 100644 lib/services/monitor/lib/lib/models/scaleRule.js create mode 100644 lib/services/monitor/lib/lib/models/senderAuthorization.js create mode 100644 lib/services/monitor/lib/lib/models/smsReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/thresholdRuleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/timeSeriesElement.js create mode 100644 lib/services/monitor/lib/lib/models/timeSeriesInformation.js create mode 100644 lib/services/monitor/lib/lib/models/timeWindow.js create mode 100644 lib/services/monitor/lib/lib/models/voiceReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/webhookNotification.js create mode 100644 lib/services/monitor/lib/lib/models/webhookReceiver.js create mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.d.ts create mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.js create mode 100644 lib/services/monitor/lib/lib/operations/actionGroups.js create mode 100644 lib/services/monitor/lib/lib/operations/activityLogAlerts.js create mode 100644 lib/services/monitor/lib/lib/operations/activityLogs.js create mode 100644 lib/services/monitor/lib/lib/operations/alertRuleIncidents.js create mode 100644 lib/services/monitor/lib/lib/operations/alertRules.js create mode 100644 lib/services/monitor/lib/lib/operations/autoscaleSettings.js create mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js create mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js create mode 100644 lib/services/monitor/lib/lib/operations/eventCategories.js create mode 100644 lib/services/monitor/lib/lib/operations/index.d.ts create mode 100644 lib/services/monitor/lib/lib/operations/index.js create mode 100644 lib/services/monitor/lib/lib/operations/logProfiles.js create mode 100644 lib/services/monitor/lib/lib/operations/metricAlerts.js create mode 100644 lib/services/monitor/lib/lib/operations/metricAlertsStatus.js create mode 100644 lib/services/monitor/lib/lib/operations/metricBaseline.js create mode 100644 lib/services/monitor/lib/lib/operations/metricDefinitions.js create mode 100644 lib/services/monitor/lib/lib/operations/metrics.js create mode 100644 lib/services/monitor/lib/lib/operations/operations.js create mode 100644 lib/services/monitor/lib/lib/operations/tenantActivityLogs.js create mode 100644 lib/services/monitor/lib/package.json diff --git a/lib/services/monitor/lib/LICENSE.txt b/lib/services/monitor/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/monitor/lib/LICENSE.txt @@ -0,0 +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. diff --git a/lib/services/monitor/lib/lib/models/action.js b/lib/services/monitor/lib/lib/models/action.js new file mode 100644 index 0000000000..91eaf1b94d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/action.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 Action { + /** + * Create a Action. + * @member {string} [actionGroupId] the id of the action group to use. + * @member {object} [webhookProperties] + */ + constructor() { + } + + /** + * Defines the metadata of Action + * + * @returns {object} metadata of Action + * + */ + mapper() { + return { + required: false, + serializedName: 'Action', + type: { + name: 'Composite', + className: 'Action', + 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 = Action; diff --git a/lib/services/monitor/lib/lib/models/actionGroupList.js b/lib/services/monitor/lib/lib/models/actionGroupList.js new file mode 100644 index 0000000000..686e1c81f9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/actionGroupList.js @@ -0,0 +1,61 @@ +/* + * 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 list of action groups. + */ +class ActionGroupList extends Array { + /** + * Create a ActionGroupList. + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActionGroupList + * + * @returns {object} metadata of ActionGroupList + * + */ + mapper() { + return { + required: false, + serializedName: 'ActionGroupList', + type: { + name: 'Composite', + className: 'ActionGroupList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionGroupResourceElementType', + type: { + name: 'Composite', + className: 'ActionGroupResource' + } + } + } + } + } + } + }; + } +} + +module.exports = ActionGroupList; diff --git a/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js b/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js new file mode 100644 index 0000000000..c55155969f --- /dev/null +++ b/lib/services/monitor/lib/lib/models/actionGroupPatchBody.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'; + +/** + * An action group object for the body of patch operations. + * + */ +class ActionGroupPatchBody { + /** + * Create a ActionGroupPatchBody. + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its actions will + * be activated. Default value: true . + */ + constructor() { + } + + /** + * Defines the metadata of ActionGroupPatchBody + * + * @returns {object} metadata of ActionGroupPatchBody + * + */ + mapper() { + return { + required: false, + serializedName: 'ActionGroupPatchBody', + type: { + name: 'Composite', + className: 'ActionGroupPatchBody', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ActionGroupPatchBody; diff --git a/lib/services/monitor/lib/lib/models/actionGroupResource.js b/lib/services/monitor/lib/lib/models/actionGroupResource.js new file mode 100644 index 0000000000..9a443885a8 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/actionGroupResource.js @@ -0,0 +1,269 @@ +/* + * 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'); + +/** + * An action group resource. + * + * @extends models['Resource'] + */ +class ActionGroupResource extends models['Resource'] { + /** + * Create a ActionGroupResource. + * @member {string} groupShortName The short name of the action group. This + * will be used in SMS messages. + * @member {boolean} enabled Indicates whether this action group is enabled. + * If an action group is not enabled, then none of its receivers will receive + * communications. Default value: true . + * @member {array} [emailReceivers] The list of email receivers that are part + * of this action group. + * @member {array} [smsReceivers] The list of SMS receivers that are part of + * this action group. + * @member {array} [webhookReceivers] The list of webhook receivers that are + * part of this action group. + * @member {array} [itsmReceivers] The list of ITSM receivers that are part + * of this action group. + * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers + * 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(); + } + + /** + * Defines the metadata of ActionGroupResource + * + * @returns {object} metadata of ActionGroupResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ActionGroupResource', + type: { + name: 'Composite', + className: 'ActionGroupResource', + 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' + } + } + } + }, + groupShortName: { + required: true, + serializedName: 'properties.groupShortName', + constraints: { + MaxLength: 15 + }, + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + emailReceivers: { + required: false, + serializedName: 'properties.emailReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EmailReceiverElementType', + type: { + name: 'Composite', + className: 'EmailReceiver' + } + } + } + }, + smsReceivers: { + required: false, + serializedName: 'properties.smsReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SmsReceiverElementType', + type: { + name: 'Composite', + className: 'SmsReceiver' + } + } + } + }, + webhookReceivers: { + required: false, + serializedName: 'properties.webhookReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebhookReceiverElementType', + type: { + name: 'Composite', + className: 'WebhookReceiver' + } + } + } + }, + itsmReceivers: { + required: false, + serializedName: 'properties.itsmReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ItsmReceiverElementType', + type: { + name: 'Composite', + className: 'ItsmReceiver' + } + } + } + }, + azureAppPushReceivers: { + required: false, + serializedName: 'properties.azureAppPushReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AzureAppPushReceiverElementType', + type: { + name: 'Composite', + className: 'AzureAppPushReceiver' + } + } + } + }, + automationRunbookReceivers: { + required: false, + serializedName: 'properties.automationRunbookReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutomationRunbookReceiverElementType', + type: { + name: 'Composite', + className: 'AutomationRunbookReceiver' + } + } + } + }, + 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' + } + } + } + } + } + } + }; + } +} + +module.exports = ActionGroupResource; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js new file mode 100644 index 0000000000..727c96320c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.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 pointer to an Azure Action Group. + * + */ +class ActivityLogAlertActionGroup { + /** + * Create a ActivityLogAlertActionGroup. + * @member {string} actionGroupId The resourceId of the action group. This + * cannot be null or empty. + * @member {object} [webhookProperties] the dictionary of custom properties + * to include with the post operation. These data are appended to the webhook + * payload. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertActionGroup + * + * @returns {object} metadata of ActivityLogAlertActionGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertActionGroup', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionGroup', + modelProperties: { + actionGroupId: { + required: true, + serializedName: 'actionGroupId', + type: { + name: 'String' + } + }, + webhookProperties: { + required: false, + serializedName: 'webhookProperties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertActionGroup; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js new file mode 100644 index 0000000000..2de7dd16fe --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js @@ -0,0 +1,62 @@ +/* + * 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'); + +/** + * A list of activity log alert actions. + * + */ +class ActivityLogAlertActionList { + /** + * Create a ActivityLogAlertActionList. + * @member {array} [actionGroups] The list of activity log alerts. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertActionList + * + * @returns {object} metadata of ActivityLogAlertActionList + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertActionList', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionList', + modelProperties: { + actionGroups: { + required: false, + serializedName: 'actionGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityLogAlertActionGroupElementType', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertActionList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js new file mode 100644 index 0000000000..234f03ce70 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.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'; + +const models = require('./index'); + +/** + * An Activity Log alert condition that is met when all its member conditions + * are met. + * + */ +class ActivityLogAlertAllOfCondition { + /** + * Create a ActivityLogAlertAllOfCondition. + * @member {array} allOf The list of activity log alert conditions. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertAllOfCondition + * + * @returns {object} metadata of ActivityLogAlertAllOfCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertAllOfCondition', + type: { + name: 'Composite', + className: 'ActivityLogAlertAllOfCondition', + modelProperties: { + allOf: { + required: true, + serializedName: 'allOf', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityLogAlertLeafConditionElementType', + type: { + name: 'Composite', + className: 'ActivityLogAlertLeafCondition' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertAllOfCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js new file mode 100644 index 0000000000..df05750642 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js @@ -0,0 +1,66 @@ +/* + * 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 Activity Log alert condition that is met by comparing an activity log + * field and value. + * + */ +class ActivityLogAlertLeafCondition { + /** + * Create a ActivityLogAlertLeafCondition. + * @member {string} field The name of the field that this condition will + * examine. The possible values for this field are (case-insensitive): + * 'resourceId', 'category', 'caller', 'level', 'operationName', + * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + * 'resourceType', or anything beginning with 'properties.'. + * @member {string} equals The field value will be compared to this value + * (case-insensitive) to determine if the condition is met. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertLeafCondition + * + * @returns {object} metadata of ActivityLogAlertLeafCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertLeafCondition', + type: { + name: 'Composite', + className: 'ActivityLogAlertLeafCondition', + modelProperties: { + field: { + required: true, + serializedName: 'field', + type: { + name: 'String' + } + }, + equals: { + required: true, + serializedName: 'equals', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertLeafCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertList.js b/lib/services/monitor/lib/lib/models/activityLogAlertList.js new file mode 100644 index 0000000000..6379f702f8 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertList.js @@ -0,0 +1,61 @@ +/* + * 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 list of activity log alerts. + */ +class ActivityLogAlertList extends Array { + /** + * Create a ActivityLogAlertList. + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActivityLogAlertList + * + * @returns {object} metadata of ActivityLogAlertList + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertList', + type: { + name: 'Composite', + className: 'ActivityLogAlertList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityLogAlertResourceElementType', + type: { + name: 'Composite', + className: 'ActivityLogAlertResource' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js b/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js new file mode 100644 index 0000000000..aa120768da --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.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'; + +/** + * An activity log alert object for the body of patch operations. + * + */ +class ActivityLogAlertPatchBody { + /** + * Create a ActivityLogAlertPatchBody. + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertPatchBody + * + * @returns {object} metadata of ActivityLogAlertPatchBody + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertPatchBody', + type: { + name: 'Composite', + className: 'ActivityLogAlertPatchBody', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertPatchBody; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertResource.js b/lib/services/monitor/lib/lib/models/activityLogAlertResource.js new file mode 100644 index 0000000000..dc857e34d9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertResource.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * An activity log alert resource. + * + * @extends models['Resource'] + */ +class ActivityLogAlertResource extends models['Resource'] { + /** + * Create a ActivityLogAlertResource. + * @member {array} scopes A list of resourceIds that will be used as + * prefixes. The alert will only apply to activityLogs with resourceIds that + * fall under one of these prefixes. This list must include at least one + * item. + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + * @member {object} condition The condition that will cause this alert to + * activate. + * @member {array} [condition.allOf] The list of activity log alert + * conditions. + * @member {object} actions The actions that will activate when the condition + * is met. + * @member {array} [actions.actionGroups] The list of activity log alerts. + * @member {string} [description] A description of this activity log alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActivityLogAlertResource + * + * @returns {object} metadata of ActivityLogAlertResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertResource', + type: { + name: 'Composite', + className: 'ActivityLogAlertResource', + 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' + } + } + } + }, + scopes: { + required: true, + serializedName: 'properties.scopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + condition: { + required: true, + serializedName: 'properties.condition', + type: { + name: 'Composite', + className: 'ActivityLogAlertAllOfCondition' + } + }, + actions: { + required: true, + serializedName: 'properties.actions', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionList' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResource.js b/lib/services/monitor/lib/lib/models/alertRuleResource.js new file mode 100644 index 0000000000..40978cb847 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/alertRuleResource.js @@ -0,0 +1,175 @@ +/* + * 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 alert rule resource. + * + * @extends models['Resource'] + */ +class AlertRuleResource extends models['Resource'] { + /** + * Create a AlertRuleResource. + * @member {string} alertRuleResourceName the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property + * cannot be updated for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic + * Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AlertRuleResource + * + * @returns {object} metadata of AlertRuleResource + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertRuleResource', + type: { + name: 'Composite', + className: 'AlertRuleResource', + 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' + } + } + } + }, + alertRuleResourceName: { + required: true, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + condition: { + required: true, + serializedName: 'properties.condition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'RuleCondition' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RuleActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleAction' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = AlertRuleResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js b/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js new file mode 100644 index 0000000000..40dd02b71e --- /dev/null +++ b/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.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 alert rule resources. + */ +class AlertRuleResourceCollection extends Array { + /** + * Create a AlertRuleResourceCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AlertRuleResourceCollection + * + * @returns {object} metadata of AlertRuleResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertRuleResourceCollection', + type: { + name: 'Composite', + className: 'AlertRuleResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AlertRuleResourceElementType', + type: { + name: 'Composite', + className: 'AlertRuleResource' + } + } + } + } + } + } + }; + } +} + +module.exports = AlertRuleResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js b/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js new file mode 100644 index 0000000000..3094d95d8b --- /dev/null +++ b/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js @@ -0,0 +1,143 @@ +/* + * 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 alert rule object for patch operations. + * + */ +class AlertRuleResourcePatch { + /** + * Create a AlertRuleResourcePatch. + * @member {object} [tags] Resource tags + * @member {string} name the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property + * cannot be updated for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic + * Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + } + + /** + * Defines the metadata of AlertRuleResourcePatch + * + * @returns {object} metadata of AlertRuleResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertRuleResourcePatch', + type: { + name: 'Composite', + className: 'AlertRuleResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + name: { + required: true, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + condition: { + required: true, + serializedName: 'properties.condition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'RuleCondition' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RuleActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleAction' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = AlertRuleResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js b/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js new file mode 100644 index 0000000000..b54ae4d250 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js @@ -0,0 +1,95 @@ +/* + * 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 Azure Automation Runbook notification receiver. + * + */ +class AutomationRunbookReceiver { + /** + * Create a AutomationRunbookReceiver. + * @member {string} automationAccountId The Azure automation account Id which + * holds this runbook and authenticate to Azure resource. + * @member {string} runbookName The name for this runbook. + * @member {string} webhookResourceId The resource id for webhook linked to + * this runbook. + * @member {boolean} isGlobalRunbook Indicates whether this instance is + * global runbook. + * @member {string} [name] Indicates name of the webhook. + * @member {string} [serviceUri] The URI where webhooks should be sent. + */ + constructor() { + } + + /** + * Defines the metadata of AutomationRunbookReceiver + * + * @returns {object} metadata of AutomationRunbookReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomationRunbookReceiver', + type: { + name: 'Composite', + className: 'AutomationRunbookReceiver', + modelProperties: { + automationAccountId: { + required: true, + serializedName: 'automationAccountId', + type: { + name: 'String' + } + }, + runbookName: { + required: true, + serializedName: 'runbookName', + type: { + name: 'String' + } + }, + webhookResourceId: { + required: true, + serializedName: 'webhookResourceId', + type: { + name: 'String' + } + }, + isGlobalRunbook: { + required: true, + serializedName: 'isGlobalRunbook', + type: { + name: 'Boolean' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + serviceUri: { + required: false, + serializedName: 'serviceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutomationRunbookReceiver; diff --git a/lib/services/monitor/lib/lib/models/autoscaleNotification.js b/lib/services/monitor/lib/lib/models/autoscaleNotification.js new file mode 100644 index 0000000000..d56fcbc701 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleNotification.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'; + +const models = require('./index'); + +/** + * Autoscale notification. + * + */ +class AutoscaleNotification { + /** + * Create a AutoscaleNotification. + * @member {object} [email] the email notification. + * @member {boolean} [email.sendToSubscriptionAdministrator] a value + * indicating whether to send email to subscription administrator. + * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value + * indicating whether to send email to subscription co-administrators. + * @member {array} [email.customEmails] the custom e-mails list. This value + * can be null or empty, in which case this attribute will be ignored. + * @member {array} [webhooks] the collection of webhook notifications. + */ + constructor() { + } + + /** + * Defines the metadata of AutoscaleNotification + * + * @returns {object} metadata of AutoscaleNotification + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleNotification', + type: { + name: 'Composite', + className: 'AutoscaleNotification', + modelProperties: { + operation: { + required: true, + isConstant: true, + serializedName: 'operation', + defaultValue: 'Scale', + type: { + name: 'String' + } + }, + email: { + required: false, + serializedName: 'email', + type: { + name: 'Composite', + className: 'EmailNotification' + } + }, + webhooks: { + required: false, + serializedName: 'webhooks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebhookNotificationElementType', + type: { + name: 'Composite', + className: 'WebhookNotification' + } + } + } + } + } + } + }; + } +} + +module.exports = AutoscaleNotification; diff --git a/lib/services/monitor/lib/lib/models/autoscaleProfile.js b/lib/services/monitor/lib/lib/models/autoscaleProfile.js new file mode 100644 index 0000000000..a26c7a898f --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleProfile.js @@ -0,0 +1,204 @@ +/* + * 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'); + +/** + * Autoscale profile. + * + */ +class AutoscaleProfile { + /** + * Create a AutoscaleProfile. + * @member {string} name the name of the profile. + * @member {object} capacity the number of instances that can be used during + * this profile. + * @member {string} [capacity.minimum] the minimum number of instances for + * the resource. + * @member {string} [capacity.maximum] the maximum number of instances for + * the resource. The actual maximum number of instances is limited by the + * cores that are available in the subscription. + * @member {string} [capacity.default] the number of instances that will be + * set if metrics are not available for evaluation. The default is only used + * if the current instance count is lower than the default. + * @member {array} rules the collection of rules that provide the triggers + * and parameters for the scaling action. A maximum of 10 rules can be + * specified. + * @member {object} [fixedDate] the specific date-time for the profile. This + * element is not used if the Recurrence element is used. + * @member {string} [fixedDate.timeZone] the timezone of the start and end + * times for the profile. Some examples of valid timezones are: Dateline + * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, + * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain + * Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, + * Central America Standard Time, Central Standard Time, Central Standard + * Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, + * Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, + * Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard + * Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland + * Standard Time, E. South America Standard Time, Argentina Standard Time, SA + * Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, + * Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard + * Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard + * Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe + * Standard Time, Romance Standard Time, Central European Standard Time, W. + * Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, + * GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria + * Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE + * Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad + * Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard + * Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard + * Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, + * Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, + * Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard + * Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard + * Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard + * Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar + * Standard Time, SE Asia Standard Time, North Asia Standard Time, China + * Standard Time, North Asia East Standard Time, Singapore Standard Time, W. + * Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia + * Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New + * Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard + * Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {date} [fixedDate.start] the start time for the profile in ISO + * 8601 format. + * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 + * 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 + * of the profile. Some examples of valid timezones are: Dateline Standard + * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific + * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, + * Mountain Standard Time (Mexico), Mountain Standard Time, Central America + * Standard Time, Central Standard Time, Central Standard Time (Mexico), + * Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard + * Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard + * Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western + * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + * South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [recurrence.schedule.days] the collection of days that the + * profile takes effect on. Possible values are Sunday through Saturday. + * @member {array} [recurrence.schedule.hours] A collection of hours that the + * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock + * (AM/PM times are not supported). + * @member {array} [recurrence.schedule.minutes] A collection of minutes at + * which the profile takes effect at. + */ + constructor() { + } + + /** + * Defines the metadata of AutoscaleProfile + * + * @returns {object} metadata of AutoscaleProfile + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleProfile', + type: { + name: 'Composite', + className: 'AutoscaleProfile', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + capacity: { + required: true, + serializedName: 'capacity', + type: { + name: 'Composite', + className: 'ScaleCapacity' + } + }, + rules: { + required: true, + serializedName: 'rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ScaleRuleElementType', + type: { + name: 'Composite', + className: 'ScaleRule' + } + } + } + }, + fixedDate: { + required: false, + serializedName: 'fixedDate', + type: { + name: 'Composite', + className: 'TimeWindow' + } + }, + recurrence: { + required: false, + serializedName: 'recurrence', + type: { + name: 'Composite', + className: 'Recurrence' + } + } + } + } + }; + } +} + +module.exports = AutoscaleProfile; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js new file mode 100644 index 0000000000..d5363c2f72 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js @@ -0,0 +1,159 @@ +/* + * 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 autoscale setting resource. + * + * @extends models['Resource'] + */ +class AutoscaleSettingResource extends models['Resource'] { + /** + * Create a AutoscaleSettingResource. + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [autoscaleSettingResourceName] the name of the autoscale + * setting. + * @member {string} [targetResourceUri] the resource identifier of the + * resource that the autoscale setting should be added to. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutoscaleSettingResource + * + * @returns {object} metadata of AutoscaleSettingResource + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleSettingResource', + type: { + name: 'Composite', + className: 'AutoscaleSettingResource', + 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' + } + } + } + }, + profiles: { + required: true, + serializedName: 'properties.profiles', + constraints: { + MaxItems: 20 + }, + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleProfileElementType', + type: { + name: 'Composite', + className: 'AutoscaleProfile' + } + } + } + }, + notifications: { + required: false, + serializedName: 'properties.notifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleNotificationElementType', + type: { + name: 'Composite', + className: 'AutoscaleNotification' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + autoscaleSettingResourceName: { + required: false, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + targetResourceUri: { + required: false, + serializedName: 'properties.targetResourceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutoscaleSettingResource; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js new file mode 100644 index 0000000000..0f0ca6ac53 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.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'; + +/** + * Represents a collection of autoscale setting resources. + */ +class AutoscaleSettingResourceCollection extends Array { + /** + * Create a AutoscaleSettingResourceCollection. + * @member {string} [nextLink] URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutoscaleSettingResourceCollection + * + * @returns {object} metadata of AutoscaleSettingResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleSettingResourceCollection', + type: { + name: 'Composite', + className: 'AutoscaleSettingResourceCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleSettingResourceElementType', + type: { + name: 'Composite', + className: 'AutoscaleSettingResource' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutoscaleSettingResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js new file mode 100644 index 0000000000..fe1ac2f14a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js @@ -0,0 +1,126 @@ +/* + * 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 autoscale setting object for patch operations. + * + */ +class AutoscaleSettingResourcePatch { + /** + * Create a AutoscaleSettingResourcePatch. + * @member {object} [tags] Resource tags + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [name] the name of the autoscale setting. + * @member {string} [targetResourceUri] the resource identifier of the + * resource that the autoscale setting should be added to. + */ + constructor() { + } + + /** + * Defines the metadata of AutoscaleSettingResourcePatch + * + * @returns {object} metadata of AutoscaleSettingResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleSettingResourcePatch', + type: { + name: 'Composite', + className: 'AutoscaleSettingResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + profiles: { + required: true, + serializedName: 'properties.profiles', + constraints: { + MaxItems: 20 + }, + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleProfileElementType', + type: { + name: 'Composite', + className: 'AutoscaleProfile' + } + } + } + }, + notifications: { + required: false, + serializedName: 'properties.notifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleNotificationElementType', + type: { + name: 'Composite', + className: 'AutoscaleNotification' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + name: { + required: false, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + targetResourceUri: { + required: false, + serializedName: 'properties.targetResourceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutoscaleSettingResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js b/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js new file mode 100644 index 0000000000..0360bb90f0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js @@ -0,0 +1,62 @@ +/* + * 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 Azure mobile App push notification receiver. + * + */ +class AzureAppPushReceiver { + /** + * Create a AzureAppPushReceiver. + * @member {string} name The name of the Azure mobile app push receiver. + * Names must be unique across all receivers within an action group. + * @member {string} emailAddress The email address registered for the Azure + * mobile app. + */ + constructor() { + } + + /** + * Defines the metadata of AzureAppPushReceiver + * + * @returns {object} metadata of AzureAppPushReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureAppPushReceiver', + type: { + name: 'Composite', + className: 'AzureAppPushReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + emailAddress: { + required: true, + serializedName: 'emailAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureAppPushReceiver; diff --git a/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js b/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js new file mode 100644 index 0000000000..1252eef8a7 --- /dev/null +++ b/lib/services/monitor/lib/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/monitor/lib/lib/models/baseline.js b/lib/services/monitor/lib/lib/models/baseline.js new file mode 100644 index 0000000000..ffd9d6f3eb --- /dev/null +++ b/lib/services/monitor/lib/lib/models/baseline.js @@ -0,0 +1,84 @@ +/* + * 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 baseline values for a single sensitivity value. + * + */ +class Baseline { + /** + * Create a Baseline. + * @member {string} sensitivity the sensitivity of the baseline. Possible + * values include: 'Low', 'Medium', 'High' + * @member {array} lowThresholds The low thresholds of the baseline. + * @member {array} highThresholds The high thresholds of the baseline. + */ + constructor() { + } + + /** + * Defines the metadata of Baseline + * + * @returns {object} metadata of Baseline + * + */ + mapper() { + return { + required: false, + serializedName: 'Baseline', + type: { + name: 'Composite', + className: 'Baseline', + modelProperties: { + sensitivity: { + required: true, + serializedName: 'sensitivity', + type: { + name: 'Enum', + allowedValues: [ 'Low', 'Medium', 'High' ] + } + }, + lowThresholds: { + required: true, + serializedName: 'lowThresholds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + highThresholds: { + required: true, + serializedName: 'highThresholds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = Baseline; diff --git a/lib/services/monitor/lib/lib/models/baselineMetadataValue.js b/lib/services/monitor/lib/lib/models/baselineMetadataValue.js new file mode 100644 index 0000000000..f0353fa4b3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/baselineMetadataValue.js @@ -0,0 +1,65 @@ +/* + * 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'); + +/** + * Represents a baseline metadata value. + * + */ +class BaselineMetadataValue { + /** + * Create a BaselineMetadataValue. + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ + constructor() { + } + + /** + * Defines the metadata of BaselineMetadataValue + * + * @returns {object} metadata of BaselineMetadataValue + * + */ + mapper() { + return { + required: false, + serializedName: 'BaselineMetadataValue', + type: { + name: 'Composite', + className: 'BaselineMetadataValue', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BaselineMetadataValue; diff --git a/lib/services/monitor/lib/lib/models/baselineResponse.js b/lib/services/monitor/lib/lib/models/baselineResponse.js new file mode 100644 index 0000000000..db9e23dd39 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/baselineResponse.js @@ -0,0 +1,154 @@ +/* + * 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 response to a baseline query. + * + */ +class BaselineResponse { + /** + * Create a BaselineResponse. + * @member {string} [id] the metric baseline Id. + * @member {string} [type] the resource type of the baseline resource. + * @member {object} [name] the name and the display name of the metric, i.e. + * it is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [timespan] The timespan for which the data was retrieved. + * Its value consists of two datatimes concatenated, separated by '/'. This + * may be adjusted in the future and returned back from what was originally + * requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if + * a metadata request was made. + * @member {string} [aggregation] The aggregation type of the metric. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} [baseline] the baseline values for each sensitivity. + * @member {array} [metadata] the baseline metadata values. + */ + constructor() { + } + + /** + * Defines the metadata of BaselineResponse + * + * @returns {object} metadata of BaselineResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'BaselineResponse', + type: { + name: 'Composite', + className: 'BaselineResponse', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + timespan: { + required: false, + serializedName: 'properties.timespan', + type: { + name: 'String' + } + }, + interval: { + required: false, + serializedName: 'properties.interval', + type: { + name: 'TimeSpan' + } + }, + aggregation: { + required: false, + serializedName: 'properties.aggregation', + type: { + name: 'String' + } + }, + timestamps: { + required: false, + serializedName: 'properties.timestamps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DateElementType', + type: { + name: 'DateTime' + } + } + } + }, + baseline: { + required: false, + serializedName: 'properties.baseline', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaselineElementType', + type: { + name: 'Composite', + className: 'Baseline' + } + } + } + }, + metadata: { + required: false, + serializedName: 'properties.metadata', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaselineMetadataValueElementType', + type: { + name: 'Composite', + className: 'BaselineMetadataValue' + } + } + } + } + } + } + }; + } +} + +module.exports = BaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js b/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js new file mode 100644 index 0000000000..3b8328e966 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js @@ -0,0 +1,85 @@ +/* + * 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 response to a calcualte baseline call. + * + */ +class CalculateBaselineResponse { + /** + * Create a CalculateBaselineResponse. + * @member {string} type the resource type of the baseline resource. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} baseline the baseline values for each sensitivity. + */ + constructor() { + } + + /** + * Defines the metadata of CalculateBaselineResponse + * + * @returns {object} metadata of CalculateBaselineResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'CalculateBaselineResponse', + type: { + name: 'Composite', + className: 'CalculateBaselineResponse', + modelProperties: { + type: { + required: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + timestamps: { + required: false, + serializedName: 'timestamps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DateElementType', + type: { + name: 'DateTime' + } + } + } + }, + baseline: { + required: true, + serializedName: 'baseline', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaselineElementType', + type: { + name: 'Composite', + className: 'Baseline' + } + } + } + } + } + } + }; + } +} + +module.exports = CalculateBaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js new file mode 100644 index 0000000000..00e2c23663 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js @@ -0,0 +1,82 @@ +/* + * 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 diagnostic settings category resource. + * + * @extends models['ProxyOnlyResource'] + */ +class DiagnosticSettingsCategoryResource extends models['ProxyOnlyResource'] { + /** + * Create a DiagnosticSettingsCategoryResource. + * @member {string} [categoryType] The type of the diagnostic settings + * category. Possible values include: 'Metrics', 'Logs' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiagnosticSettingsCategoryResource + * + * @returns {object} metadata of DiagnosticSettingsCategoryResource + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsCategoryResource', + type: { + name: 'Composite', + className: 'DiagnosticSettingsCategoryResource', + 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' + } + }, + categoryType: { + required: false, + serializedName: 'properties.categoryType', + type: { + name: 'Enum', + allowedValues: [ 'Metrics', 'Logs' ] + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsCategoryResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js new file mode 100644 index 0000000000..00199aec14 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.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'; + +const models = require('./index'); + +/** + * Represents a collection of diagnostic setting category resources. + * + */ +class DiagnosticSettingsCategoryResourceCollection { + /** + * Create a DiagnosticSettingsCategoryResourceCollection. + * @member {array} [value] The collection of diagnostic settings category + * resources. + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticSettingsCategoryResourceCollection + * + * @returns {object} metadata of DiagnosticSettingsCategoryResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsCategoryResourceCollection', + type: { + name: 'Composite', + className: 'DiagnosticSettingsCategoryResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiagnosticSettingsCategoryResourceElementType', + type: { + name: 'Composite', + className: 'DiagnosticSettingsCategoryResource' + } + } + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsCategoryResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js new file mode 100644 index 0000000000..b255747c24 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js @@ -0,0 +1,142 @@ +/* + * 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 diagnostic setting resource. + * + * @extends models['ProxyOnlyResource'] + */ +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} [eventHubAuthorizationRuleId] The resource Id for the + * event hub authorization rule. + * @member {string} [eventHubName] The name of the event hub. If none is + * specified, the default event hub will be selected. + * @member {array} [metrics] the list of metric settings. + * @member {array} [logs] the list of logs settings. + * @member {string} [workspaceId] The workspace ID (resource ID of a Log + * Analytics workspace) for a Log Analytics workspace to which you would like + * to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiagnosticSettingsResource + * + * @returns {object} metadata of DiagnosticSettingsResource + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsResource', + type: { + name: 'Composite', + className: 'DiagnosticSettingsResource', + 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' + } + }, + storageAccountId: { + required: false, + serializedName: 'properties.storageAccountId', + type: { + name: 'String' + } + }, + eventHubAuthorizationRuleId: { + required: false, + serializedName: 'properties.eventHubAuthorizationRuleId', + type: { + name: 'String' + } + }, + eventHubName: { + required: false, + serializedName: 'properties.eventHubName', + type: { + name: 'String' + } + }, + metrics: { + required: false, + serializedName: 'properties.metrics', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricSettingsElementType', + type: { + name: 'Composite', + className: 'MetricSettings' + } + } + } + }, + logs: { + required: false, + serializedName: 'properties.logs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogSettingsElementType', + type: { + name: 'Composite', + className: 'LogSettings' + } + } + } + }, + workspaceId: { + required: false, + serializedName: 'properties.workspaceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js new file mode 100644 index 0000000000..89650e1336 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js @@ -0,0 +1,62 @@ +/* + * 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'); + +/** + * Represents a collection of alert rule resources. + * + */ +class DiagnosticSettingsResourceCollection { + /** + * Create a DiagnosticSettingsResourceCollection. + * @member {array} [value] The collection of diagnostic settings resources;. + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticSettingsResourceCollection + * + * @returns {object} metadata of DiagnosticSettingsResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsResourceCollection', + type: { + name: 'Composite', + className: 'DiagnosticSettingsResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiagnosticSettingsResourceElementType', + type: { + name: 'Composite', + className: 'DiagnosticSettingsResource' + } + } + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/emailNotification.js b/lib/services/monitor/lib/lib/models/emailNotification.js new file mode 100644 index 0000000000..c11f1b2d24 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/emailNotification.js @@ -0,0 +1,78 @@ +/* + * 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'; + +/** + * Email notification of an autoscale event. + * + */ +class EmailNotification { + /** + * Create a EmailNotification. + * @member {boolean} [sendToSubscriptionAdministrator] a value indicating + * whether to send email to subscription administrator. + * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating + * whether to send email to subscription co-administrators. + * @member {array} [customEmails] the custom e-mails list. This value can be + * null or empty, in which case this attribute will be ignored. + */ + constructor() { + } + + /** + * Defines the metadata of EmailNotification + * + * @returns {object} metadata of EmailNotification + * + */ + mapper() { + return { + required: false, + serializedName: 'EmailNotification', + type: { + name: 'Composite', + className: 'EmailNotification', + modelProperties: { + sendToSubscriptionAdministrator: { + required: false, + serializedName: 'sendToSubscriptionAdministrator', + type: { + name: 'Boolean' + } + }, + sendToSubscriptionCoAdministrators: { + required: false, + serializedName: 'sendToSubscriptionCoAdministrators', + type: { + name: 'Boolean' + } + }, + customEmails: { + required: false, + serializedName: 'customEmails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = EmailNotification; diff --git a/lib/services/monitor/lib/lib/models/emailReceiver.js b/lib/services/monitor/lib/lib/models/emailReceiver.js new file mode 100644 index 0000000000..508eac1ad4 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/emailReceiver.js @@ -0,0 +1,72 @@ +/* + * 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 email receiver. + * + */ +class EmailReceiver { + /** + * Create a EmailReceiver. + * @member {string} name The name of the email receiver. Names must be unique + * across all receivers within an action group. + * @member {string} emailAddress The email address of this receiver. + * @member {string} [status] The receiver status of the e-mail. Possible + * values include: 'NotSpecified', 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of EmailReceiver + * + * @returns {object} metadata of EmailReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'EmailReceiver', + type: { + name: 'Composite', + className: 'EmailReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + emailAddress: { + required: true, + serializedName: 'emailAddress', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] + } + } + } + } + }; + } +} + +module.exports = EmailReceiver; diff --git a/lib/services/monitor/lib/lib/models/enableRequest.js b/lib/services/monitor/lib/lib/models/enableRequest.js new file mode 100644 index 0000000000..886d80bc33 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/enableRequest.js @@ -0,0 +1,52 @@ +/* + * 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'; + +/** + * Describes a receiver that should be resubscribed. + * + */ +class EnableRequest { + /** + * Create a EnableRequest. + * @member {string} receiverName The name of the receiver to resubscribe. + */ + constructor() { + } + + /** + * Defines the metadata of EnableRequest + * + * @returns {object} metadata of EnableRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'EnableRequest', + type: { + name: 'Composite', + className: 'EnableRequest', + modelProperties: { + receiverName: { + required: true, + serializedName: 'receiverName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnableRequest; diff --git a/lib/services/monitor/lib/lib/models/errorResponse.js b/lib/services/monitor/lib/lib/models/errorResponse.js new file mode 100644 index 0000000000..f952d62061 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/errorResponse.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Describes the format of Error response. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/monitor/lib/lib/models/eventCategoryCollection.js b/lib/services/monitor/lib/lib/models/eventCategoryCollection.js new file mode 100644 index 0000000000..5a8180acf9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/eventCategoryCollection.js @@ -0,0 +1,60 @@ +/* + * 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 collection of event categories. Currently possible values are: + * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + */ +class EventCategoryCollection extends Array { + /** + * Create a EventCategoryCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EventCategoryCollection + * + * @returns {object} metadata of EventCategoryCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'EventCategoryCollection', + type: { + name: 'Composite', + className: 'EventCategoryCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LocalizableStringElementType', + type: { + name: 'Composite', + className: 'LocalizableString' + } + } + } + } + } + } + }; + } +} + +module.exports = EventCategoryCollection; diff --git a/lib/services/monitor/lib/lib/models/eventData.js b/lib/services/monitor/lib/lib/models/eventData.js new file mode 100644 index 0000000000..4e8b1c3046 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/eventData.js @@ -0,0 +1,342 @@ +/* + * 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 Azure event log entries are of type EventData + * + */ +class EventData { + /** + * Create a EventData. + * @member {object} [authorization] + * @member {string} [authorization.action] the permissible actions. For + * instance: microsoft.support/supporttickets/write + * @member {string} [authorization.role] the role of the user. For instance: + * Subscription Admin + * @member {string} [authorization.scope] the scope. + * @member {object} [claims] key value pairs to identify ARM permissions. + * @member {string} [caller] the email address of the user who has performed + * the operation, the UPN claim or SPN claim based on availability. + * @member {string} [description] the description of the event. + * @member {string} [id] the Id of this event as required by ARM for RBAC. It + * contains the EventDataID and a timestamp information. + * @member {string} [eventDataId] the event data Id. This is a unique + * identifier for an event. + * @member {string} [correlationId] the correlation Id, usually a GUID in the + * string format. The correlation Id is shared among the events that belong + * to the same uber operation. + * @member {object} [eventName] the event name. This value should not be + * confused with OperationName. For practical purposes, OperationName might + * be more appealing to end users. + * @member {string} [eventName.value] the invariant value. + * @member {string} [eventName.localizedValue] the locale specific value. + * @member {object} [category] the event category. + * @member {string} [category.value] the invariant value. + * @member {string} [category.localizedValue] the locale specific value. + * @member {object} [httpRequest] the HTTP request info. Usually includes the + * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated + * the event) and 'method' (HTTP method e.g. PUT). + * @member {string} [httpRequest.clientRequestId] the client request id. + * @member {string} [httpRequest.clientIpAddress] the client Ip Address + * @member {string} [httpRequest.method] the Http request method. + * @member {string} [httpRequest.uri] the Uri. + * @member {string} [level] the event level. Possible values include: + * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + * @member {string} [resourceGroupName] the resource group name of the + * impacted resource. + * @member {object} [resourceProviderName] the resource provider name of the + * impacted resource. + * @member {string} [resourceProviderName.value] the invariant value. + * @member {string} [resourceProviderName.localizedValue] the locale specific + * value. + * @member {string} [resourceId] the resource uri that uniquely identifies + * the resource that caused this event. + * @member {object} [resourceType] the resource type + * @member {string} [resourceType.value] the invariant value. + * @member {string} [resourceType.localizedValue] the locale specific value. + * @member {string} [operationId] It is usually a GUID shared among the + * events corresponding to single operation. This value should not be + * confused with EventName. + * @member {object} [operationName] the operation name. + * @member {string} [operationName.value] the invariant value. + * @member {string} [operationName.localizedValue] the locale specific value. + * @member {object} [properties] the set of pairs (usually a + * Dictionary) that includes details about the event. + * @member {object} [status] a string describing the status of the operation. + * Some typical values are: Started, In progress, Succeeded, Failed, + * Resolved. + * @member {string} [status.value] the invariant value. + * @member {string} [status.localizedValue] the locale specific value. + * @member {object} [subStatus] the event sub status. Most of the time, when + * included, this captures the HTTP status code of the REST call. Common + * values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), + * Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad + * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), + * Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: + * 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP + * Status Code: 504) + * @member {string} [subStatus.value] the invariant value. + * @member {string} [subStatus.localizedValue] the locale specific value. + * @member {date} [eventTimestamp] the timestamp of when the event was + * generated by the Azure service processing the request corresponding the + * event. It in ISO 8601 format. + * @member {date} [submissionTimestamp] the timestamp of when the event + * became available for querying via this API. It is in ISO 8601 format. This + * value should not be confused eventTimestamp. As there might be a delay + * between the occurrence time of the event, and the time that the event is + * submitted to the Azure logging infrastructure. + * @member {string} [subscriptionId] the Azure subscription Id usually a + * GUID. + * @member {string} [tenantId] the Azure tenant Id + */ + constructor() { + } + + /** + * Defines the metadata of EventData + * + * @returns {object} metadata of EventData + * + */ + mapper() { + return { + required: false, + serializedName: 'EventData', + type: { + name: 'Composite', + className: 'EventData', + modelProperties: { + authorization: { + required: false, + readOnly: true, + serializedName: 'authorization', + type: { + name: 'Composite', + className: 'SenderAuthorization' + } + }, + claims: { + required: false, + readOnly: true, + serializedName: 'claims', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + caller: { + required: false, + readOnly: true, + serializedName: 'caller', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + eventDataId: { + required: false, + readOnly: true, + serializedName: 'eventDataId', + type: { + name: 'String' + } + }, + correlationId: { + required: false, + readOnly: true, + serializedName: 'correlationId', + type: { + name: 'String' + } + }, + eventName: { + required: false, + readOnly: true, + serializedName: 'eventName', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + category: { + required: false, + readOnly: true, + serializedName: 'category', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + httpRequest: { + required: false, + readOnly: true, + serializedName: 'httpRequest', + type: { + name: 'Composite', + className: 'HttpRequestInfo' + } + }, + level: { + required: false, + readOnly: true, + serializedName: 'level', + type: { + name: 'Enum', + allowedValues: [ 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' ] + } + }, + resourceGroupName: { + required: false, + readOnly: true, + serializedName: 'resourceGroupName', + type: { + name: 'String' + } + }, + resourceProviderName: { + required: false, + readOnly: true, + serializedName: 'resourceProviderName', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + resourceType: { + required: false, + readOnly: true, + serializedName: 'resourceType', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + operationId: { + required: false, + readOnly: true, + serializedName: 'operationId', + type: { + name: 'String' + } + }, + operationName: { + required: false, + readOnly: true, + serializedName: 'operationName', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + properties: { + required: false, + readOnly: true, + serializedName: 'properties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + subStatus: { + required: false, + readOnly: true, + serializedName: 'subStatus', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + eventTimestamp: { + required: false, + readOnly: true, + serializedName: 'eventTimestamp', + type: { + name: 'DateTime' + } + }, + submissionTimestamp: { + required: false, + readOnly: true, + serializedName: 'submissionTimestamp', + type: { + name: 'DateTime' + } + }, + subscriptionId: { + required: false, + readOnly: true, + serializedName: 'subscriptionId', + type: { + name: 'String' + } + }, + tenantId: { + required: false, + readOnly: true, + serializedName: 'tenantId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventData; diff --git a/lib/services/monitor/lib/lib/models/eventDataCollection.js b/lib/services/monitor/lib/lib/models/eventDataCollection.js new file mode 100644 index 0000000000..0fe4c985c9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/eventDataCollection.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Represents collection of events. + */ +class EventDataCollection extends Array { + /** + * Create a EventDataCollection. + * @member {string} [nextLink] Provides the link to retrieve the next set of + * events. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EventDataCollection + * + * @returns {object} metadata of EventDataCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'EventDataCollection', + type: { + name: 'Composite', + className: 'EventDataCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EventDataElementType', + type: { + name: 'Composite', + className: 'EventData' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventDataCollection; diff --git a/lib/services/monitor/lib/lib/models/httpRequestInfo.js b/lib/services/monitor/lib/lib/models/httpRequestInfo.js new file mode 100644 index 0000000000..309dc12fd0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/httpRequestInfo.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The Http request info. + * + */ +class HttpRequestInfo { + /** + * Create a HttpRequestInfo. + * @member {string} [clientRequestId] the client request id. + * @member {string} [clientIpAddress] the client Ip Address + * @member {string} [method] the Http request method. + * @member {string} [uri] the Uri. + */ + constructor() { + } + + /** + * Defines the metadata of HttpRequestInfo + * + * @returns {object} metadata of HttpRequestInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'HttpRequestInfo', + type: { + name: 'Composite', + className: 'HttpRequestInfo', + modelProperties: { + clientRequestId: { + required: false, + serializedName: 'clientRequestId', + type: { + name: 'String' + } + }, + clientIpAddress: { + required: false, + serializedName: 'clientIpAddress', + type: { + name: 'String' + } + }, + method: { + required: false, + serializedName: 'method', + type: { + name: 'String' + } + }, + uri: { + required: false, + serializedName: 'uri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = HttpRequestInfo; diff --git a/lib/services/monitor/lib/lib/models/incident.js b/lib/services/monitor/lib/lib/models/incident.js new file mode 100644 index 0000000000..a591fb7efa --- /dev/null +++ b/lib/services/monitor/lib/lib/models/incident.js @@ -0,0 +1,93 @@ +/* + * 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 incident indicates the activation status of an alert rule. + * + */ +class Incident { + /** + * Create a Incident. + * @member {string} [name] Incident name. + * @member {string} [ruleName] Rule name that is associated with the + * incident. + * @member {boolean} [isActive] A boolean to indicate whether the incident is + * active or resolved. + * @member {date} [activatedTime] The time at which the incident was + * activated in ISO8601 format. + * @member {date} [resolvedTime] The time at which the incident was resolved + * in ISO8601 format. If null, it means the incident is still active. + */ + constructor() { + } + + /** + * Defines the metadata of Incident + * + * @returns {object} metadata of Incident + * + */ + mapper() { + return { + required: false, + serializedName: 'Incident', + type: { + name: 'Composite', + className: 'Incident', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + ruleName: { + required: false, + readOnly: true, + serializedName: 'ruleName', + type: { + name: 'String' + } + }, + isActive: { + required: false, + readOnly: true, + serializedName: 'isActive', + type: { + name: 'Boolean' + } + }, + activatedTime: { + required: false, + readOnly: true, + serializedName: 'activatedTime', + type: { + name: 'DateTime' + } + }, + resolvedTime: { + required: false, + readOnly: true, + serializedName: 'resolvedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = Incident; diff --git a/lib/services/monitor/lib/lib/models/incidentListResult.js b/lib/services/monitor/lib/lib/models/incidentListResult.js new file mode 100644 index 0000000000..968388fb50 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/incidentListResult.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'; + +/** + * The List incidents operation response. + */ +class IncidentListResult extends Array { + /** + * Create a IncidentListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IncidentListResult + * + * @returns {object} metadata of IncidentListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'IncidentListResult', + type: { + name: 'Composite', + className: 'IncidentListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IncidentElementType', + type: { + name: 'Composite', + className: 'Incident' + } + } + } + } + } + } + }; + } +} + +module.exports = IncidentListResult; diff --git a/lib/services/monitor/lib/lib/models/index.d.ts b/lib/services/monitor/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..44807752fe --- /dev/null +++ b/lib/services/monitor/lib/lib/models/index.d.ts @@ -0,0 +1,2298 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * An azure resource object + * + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + * @member {string} location Resource location + * @member {object} [tags] Resource tags + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ScaleCapacity class. + * @constructor + * The number of instances that can be used during this profile. + * + * @member {string} minimum the minimum number of instances for the resource. + * @member {string} maximum the maximum number of instances for the resource. + * The actual maximum number of instances is limited by the cores that are + * available in the subscription. + * @member {string} default the number of instances that will be set if metrics + * are not available for evaluation. The default is only used if the current + * instance count is lower than the default. + */ +export interface ScaleCapacity { + minimum: string; + maximum: string; + default: string; +} + +/** + * @class + * Initializes a new instance of the MetricTrigger class. + * @constructor + * The trigger that results in a scaling action. + * + * @member {string} metricName the name of the metric that defines what the + * rule monitors. + * @member {string} metricResourceUri the resource identifier of the resource + * the rule monitors. + * @member {moment.duration} timeGrain the granularity of metrics the rule + * monitors. Must be one of the predefined values returned from metric + * definitions for the metric. Must be between 12 hours and 1 minute. + * @member {string} statistic the metric statistic type. How the metrics from + * multiple instances are combined. Possible values include: 'Average', 'Min', + * 'Max', 'Sum' + * @member {moment.duration} timeWindow the range of time in which instance + * data is collected. This value must be greater than the delay in metric + * collection, which can vary from resource-to-resource. Must be between 12 + * hours and 5 minutes. + * @member {string} timeAggregation time aggregation type. How the data that is + * collected should be combined over time. The default value is Average. + * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' + * @member {string} operator the operator that is used to compare the metric + * data and the threshold. Possible values include: 'Equals', 'NotEquals', + * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold of the metric that triggers the + * scale action. + */ +export interface MetricTrigger { + metricName: string; + metricResourceUri: string; + timeGrain: moment.Duration; + statistic: string; + timeWindow: moment.Duration; + timeAggregation: string; + operator: string; + threshold: number; +} + +/** + * @class + * Initializes a new instance of the ScaleAction class. + * @constructor + * The parameters for the scaling action. + * + * @member {string} direction the scale direction. Whether the scaling action + * increases or decreases the number of instances. Possible values include: + * 'None', 'Increase', 'Decrease' + * @member {string} type the type of action that should occur when the scale + * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', + * 'ExactCount' + * @member {string} [value] the number of instances that are involved in the + * scaling action. This value must be 1 or greater. The default value is 1. + * Default value: '1' . + * @member {moment.duration} cooldown the amount of time to wait since the last + * scaling action before this action occurs. It must be between 1 week and 1 + * minute in ISO 8601 format. + */ +export interface ScaleAction { + direction: string; + type: string; + value?: string; + cooldown: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the ScaleRule class. + * @constructor + * A rule that provide the triggers and parameters for the scaling action. + * + * @member {object} metricTrigger the trigger that results in a scaling action. + * @member {string} [metricTrigger.metricName] the name of the metric that + * defines what the rule monitors. + * @member {string} [metricTrigger.metricResourceUri] the resource identifier + * of the resource the rule monitors. + * @member {moment.duration} [metricTrigger.timeGrain] the granularity of + * metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [metricTrigger.statistic] the metric statistic type. How + * the metrics from multiple instances are combined. Possible values include: + * 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [metricTrigger.timeWindow] the range of time in + * which instance data is collected. This value must be greater than the delay + * in metric collection, which can vary from resource-to-resource. Must be + * between 12 hours and 5 minutes. + * @member {string} [metricTrigger.timeAggregation] time aggregation type. How + * the data that is collected should be combined over time. The default value + * is Average. Possible values include: 'Average', 'Minimum', 'Maximum', + * 'Total', 'Count' + * @member {string} [metricTrigger.operator] the operator that is used to + * compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [metricTrigger.threshold] the threshold of the metric that + * triggers the scale action. + * @member {object} scaleAction the parameters for the scaling action. + * @member {string} [scaleAction.direction] the scale direction. Whether the + * scaling action increases or decreases the number of instances. Possible + * values include: 'None', 'Increase', 'Decrease' + * @member {string} [scaleAction.type] the type of action that should occur + * when the scale rule fires. Possible values include: 'ChangeCount', + * 'PercentChangeCount', 'ExactCount' + * @member {string} [scaleAction.value] the number of instances that are + * involved in the scaling action. This value must be 1 or greater. The default + * value is 1. + * @member {moment.duration} [scaleAction.cooldown] the amount of time to wait + * since the last scaling action before this action occurs. It must be between + * 1 week and 1 minute in ISO 8601 format. + */ +export interface ScaleRule { + metricTrigger: MetricTrigger; + scaleAction: ScaleAction; +} + +/** + * @class + * Initializes a new instance of the TimeWindow class. + * @constructor + * A specific date-time for the profile. + * + * @member {string} [timeZone] the timezone of the start and end times for the + * profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central + * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern + * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic + * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, + * Pacific SA Standard Time, Newfoundland Standard Time, E. South America + * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, + * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. + * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, + * Central European Standard Time, W. Central Africa Standard Time, Namibia + * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, + * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, + * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central + * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {date} start the start time for the profile in ISO 8601 format. + * @member {date} end the end time for the profile in ISO 8601 format. + */ +export interface TimeWindow { + timeZone?: string; + start: Date; + end: Date; +} + +/** + * @class + * Initializes a new instance of the RecurrentSchedule class. + * @constructor + * The scheduling constraints for when the profile begins. + * + * @member {string} timeZone the timezone for the hours of the profile. Some + * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian + * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), + * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time + * (Mexico), Mountain Standard Time, Central America Standard Time, Central + * Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, + * SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, + * Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, + * Central Brazilian Standard Time, SA Western Standard Time, Pacific SA + * Standard Time, Newfoundland Standard Time, E. South America Standard Time, + * Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, + * Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard + * Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, + * UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, + * Central Europe Standard Time, Romance Standard Time, Central European + * Standard Time, W. Central Africa Standard Time, Namibia Standard Time, + * Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt + * Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa + * Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard + * Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, + * Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa + * Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan + * Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian + * Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia + * Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India + * Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia + * Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} days the collection of days that the profile takes effect + * on. Possible values are Sunday through Saturday. + * @member {array} hours A collection of hours that the profile takes effect + * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not + * supported). + * @member {array} minutes A collection of minutes at which the profile takes + * effect at. + */ +export interface RecurrentSchedule { + timeZone: string; + days: string[]; + hours: number[]; + minutes: number[]; +} + +/** + * @class + * Initializes a new instance of the Recurrence class. + * @constructor + * 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 + * profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central + * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern + * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic + * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, + * Pacific SA Standard Time, Newfoundland Standard Time, E. South America + * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, + * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. + * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, + * Central European Standard Time, W. Central Africa Standard Time, Namibia + * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, + * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, + * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central + * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [schedule.days] the collection of days that the profile + * takes effect on. Possible values are Sunday through Saturday. + * @member {array} [schedule.hours] A collection of hours that the profile + * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM + * times are not supported). + * @member {array} [schedule.minutes] A collection of minutes at which the + * profile takes effect at. + */ +export interface Recurrence { + frequency: string; + schedule: RecurrentSchedule; +} + +/** + * @class + * Initializes a new instance of the AutoscaleProfile class. + * @constructor + * Autoscale profile. + * + * @member {string} name the name of the profile. + * @member {object} capacity the number of instances that can be used during + * this profile. + * @member {string} [capacity.minimum] the minimum number of instances for the + * resource. + * @member {string} [capacity.maximum] the maximum number of instances for the + * resource. The actual maximum number of instances is limited by the cores + * that are available in the subscription. + * @member {string} [capacity.default] the number of instances that will be set + * if metrics are not available for evaluation. The default is only used if the + * current instance count is lower than the default. + * @member {array} rules the collection of rules that provide the triggers and + * parameters for the scaling action. A maximum of 10 rules can be specified. + * @member {object} [fixedDate] the specific date-time for the profile. This + * element is not used if the Recurrence element is used. + * @member {string} [fixedDate.timeZone] the timezone of the start and end + * times for the profile. Some examples of valid timezones are: Dateline + * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, + * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard + * Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central + * America Standard Time, Central Standard Time, Central Standard Time + * (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern + * Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay + * Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA + * Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, + * E. South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya + * Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard + * Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, + * Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, + * Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, + * Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard + * Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, + * Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, + * N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, + * North Asia Standard Time, China Standard Time, North Asia East Standard + * Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard + * Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, + * Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard + * Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + * Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok + * Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia + * Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, + * Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line + * Islands Standard Time + * @member {date} [fixedDate.start] the start time for the profile in ISO 8601 + * format. + * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 + * 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 + * of the profile. Some examples of valid timezones are: Dateline Standard + * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific + * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, + * Mountain Standard Time (Mexico), Mountain Standard Time, Central America + * Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada + * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + * Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard + * Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America + * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, + * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. + * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, + * Central European Standard Time, W. Central Africa Standard Time, Namibia + * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, + * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, + * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central + * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [recurrence.schedule.days] the collection of days that the + * profile takes effect on. Possible values are Sunday through Saturday. + * @member {array} [recurrence.schedule.hours] A collection of hours that the + * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock + * (AM/PM times are not supported). + * @member {array} [recurrence.schedule.minutes] A collection of minutes at + * which the profile takes effect at. + */ +export interface AutoscaleProfile { + name: string; + capacity: ScaleCapacity; + rules: ScaleRule[]; + fixedDate?: TimeWindow; + recurrence?: Recurrence; +} + +/** + * @class + * Initializes a new instance of the EmailNotification class. + * @constructor + * Email notification of an autoscale event. + * + * @member {boolean} [sendToSubscriptionAdministrator] a value indicating + * whether to send email to subscription administrator. + * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating + * whether to send email to subscription co-administrators. + * @member {array} [customEmails] the custom e-mails list. This value can be + * null or empty, in which case this attribute will be ignored. + */ +export interface EmailNotification { + sendToSubscriptionAdministrator?: boolean; + sendToSubscriptionCoAdministrators?: boolean; + customEmails?: string[]; +} + +/** + * @class + * Initializes a new instance of the WebhookNotification class. + * @constructor + * Webhook notification of an autoscale event. + * + * @member {string} [serviceUri] the service address to receive the + * notification. + * @member {object} [properties] a property bag of settings. This value can be + * empty. + */ +export interface WebhookNotification { + serviceUri?: string; + properties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the AutoscaleNotification class. + * @constructor + * Autoscale notification. + * + * @member {object} [email] the email notification. + * @member {boolean} [email.sendToSubscriptionAdministrator] a value indicating + * whether to send email to subscription administrator. + * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value + * indicating whether to send email to subscription co-administrators. + * @member {array} [email.customEmails] the custom e-mails list. This value can + * be null or empty, in which case this attribute will be ignored. + * @member {array} [webhooks] the collection of webhook notifications. + */ +export interface AutoscaleNotification { + email?: EmailNotification; + webhooks?: WebhookNotification[]; +} + +/** + * @class + * Initializes a new instance of the AutoscaleSettingResource class. + * @constructor + * The autoscale setting resource. + * + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [autoscaleSettingResourceName] the name of the autoscale + * setting. + * @member {string} [targetResourceUri] the resource identifier of the resource + * that the autoscale setting should be added to. + */ +export interface AutoscaleSettingResource extends Resource { + profiles: AutoscaleProfile[]; + notifications?: AutoscaleNotification[]; + enabled?: boolean; + autoscaleSettingResourceName?: string; + targetResourceUri?: string; +} + +/** + * @class + * Initializes a new instance of the AutoscaleSettingResourcePatch class. + * @constructor + * The autoscale setting object for patch operations. + * + * @member {object} [tags] Resource tags + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [name] the name of the autoscale setting. + * @member {string} [targetResourceUri] the resource identifier of the resource + * that the autoscale setting should be added to. + */ +export interface AutoscaleSettingResourcePatch { + tags?: { [propertyName: string]: string }; + profiles: AutoscaleProfile[]; + notifications?: AutoscaleNotification[]; + enabled?: boolean; + name?: string; + targetResourceUri?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * Describes the format of Error response. + * + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Display metadata associated with the operation. + * + * @member {string} [provider] Service provider: Microsoft.Insights + * @member {string} [resource] Resource on which the operation is performed: + * AlertRules, Autoscale, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Microsoft Insights API operation definition. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft.Insights + * @member {string} [display.resource] Resource on which the operation is + * performed: AlertRules, Autoscale, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ +export interface Operation { + name?: string; + display?: OperationDisplay; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * Result of the request to list Microsoft.Insights operations. It contains a + * list of operations and a URL link to get the next set of results. + * + * @member {array} [value] List of operations supported by the + * Microsoft.Insights provider. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface OperationListResult { + value?: Operation[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the Incident class. + * @constructor + * An alert incident indicates the activation status of an alert rule. + * + * @member {string} [name] Incident name. + * @member {string} [ruleName] Rule name that is associated with the incident. + * @member {boolean} [isActive] A boolean to indicate whether the incident is + * active or resolved. + * @member {date} [activatedTime] The time at which the incident was activated + * in ISO8601 format. + * @member {date} [resolvedTime] The time at which the incident was resolved in + * ISO8601 format. If null, it means the incident is still active. + */ +export interface Incident { + readonly name?: string; + readonly ruleName?: string; + readonly isActive?: boolean; + readonly activatedTime?: Date; + readonly resolvedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the RuleDataSource class. + * @constructor + * The resource from which the rule collects its data. + * + * @member {string} [resourceUri] the resource identifier of the resource the + * rule monitors. **NOTE**: this property cannot be updated for an existing + * rule. + * @member {string} odatatype Polymorphic Discriminator + */ +export interface RuleDataSource { + resourceUri?: string; + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the RuleCondition class. + * @constructor + * The condition that results in the alert rule being activated. + * + * @member {object} [dataSource] the resource from which the rule collects its + * data. For this type dataSource will always be of type RuleMetricDataSource. + * @member {string} [dataSource.resourceUri] the resource identifier of the + * resource the rule monitors. **NOTE**: this property cannot be updated for an + * existing rule. + * @member {string} [dataSource.odatatype] Polymorphic Discriminator + * @member {string} odatatype Polymorphic Discriminator + */ +export interface RuleCondition { + dataSource?: RuleDataSource; + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the RuleMetricDataSource class. + * @constructor + * A rule metric data source. The discriminator value is always + * RuleMetricDataSource in this case. + * + * @member {string} [metricName] the name of the metric that defines what the + * rule monitors. + */ +export interface RuleMetricDataSource extends RuleDataSource { + metricName?: string; +} + +/** + * @class + * Initializes a new instance of the RuleManagementEventClaimsDataSource class. + * @constructor + * The claims for a rule management event data source. + * + * @member {string} [emailAddress] the email address. + */ +export interface RuleManagementEventClaimsDataSource { + emailAddress?: string; +} + +/** + * @class + * Initializes a new instance of the RuleManagementEventDataSource class. + * @constructor + * A rule management event data source. The discriminator fields is always + * RuleManagementEventDataSource in this case. + * + * @member {string} [eventName] the event name. + * @member {string} [eventSource] the event source. + * @member {string} [level] the level. + * @member {string} [operationName] The name of the operation that should be + * checked for. If no name is provided, any operation will match. + * @member {string} [resourceGroupName] the resource group name. + * @member {string} [resourceProviderName] the resource provider name. + * @member {string} [status] The status of the operation that should be checked + * for. If no status is provided, any status will match. + * @member {string} [subStatus] the substatus. + * @member {object} [claims] the claims. + * @member {string} [claims.emailAddress] the email address. + */ +export interface RuleManagementEventDataSource extends RuleDataSource { + eventName?: string; + eventSource?: string; + level?: string; + operationName?: string; + resourceGroupName?: string; + resourceProviderName?: string; + status?: string; + subStatus?: string; + claims?: RuleManagementEventClaimsDataSource; +} + +/** + * @class + * Initializes a new instance of the ThresholdRuleCondition class. + * @constructor + * A rule condition based on a metric crossing a threshold. + * + * @member {string} operator the operator used to compare the data and the + * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', + * 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {string} [timeAggregation] the time aggregation operator. How the + * data that are collected should be combined over time. The default value is + * the PrimaryAggregationType of the Metric. Possible values include: + * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' + */ +export interface ThresholdRuleCondition extends RuleCondition { + operator: string; + threshold: number; + windowSize?: moment.Duration; + timeAggregation?: string; +} + +/** + * @class + * Initializes a new instance of the LocationThresholdRuleCondition class. + * @constructor + * A rule condition based on a certain number of locations failing. + * + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {number} failedLocationCount the number of locations that must fail + * to activate the alert. + */ +export interface LocationThresholdRuleCondition extends RuleCondition { + windowSize?: moment.Duration; + failedLocationCount: number; +} + +/** + * @class + * Initializes a new instance of the ManagementEventAggregationCondition class. + * @constructor + * How the data that is collected should be combined over time. + * + * @member {string} [operator] the condition operator. Possible values include: + * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + * @member {number} [threshold] The threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + */ +export interface ManagementEventAggregationCondition { + operator?: string; + threshold?: number; + windowSize?: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the ManagementEventRuleCondition class. + * @constructor + * A management event rule condition. + * + * @member {object} [aggregation] How the data that is collected should be + * combined over time and when the alert is activated. Note that for management + * event alerts aggregation is optional – if it is not provided then any event + * will cause the alert to activate. + * @member {string} [aggregation.operator] the condition operator. Possible + * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [aggregation.threshold] The threshold value that activates + * the alert. + * @member {moment.duration} [aggregation.windowSize] the period of time (in + * ISO 8601 duration format) that is used to monitor alert activity based on + * the threshold. If specified then it must be between 5 minutes and 1 day. + */ +export interface ManagementEventRuleCondition extends RuleCondition { + aggregation?: ManagementEventAggregationCondition; +} + +/** + * @class + * Initializes a new instance of the RuleAction class. + * @constructor + * The action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @member {string} odatatype Polymorphic Discriminator + */ +export interface RuleAction { + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the RuleEmailAction class. + * @constructor + * Specifies the action to send email when the rule condition is evaluated. The + * discriminator is always RuleEmailAction in this case. + * + * @member {boolean} [sendToServiceOwners] Whether the administrators (service + * and co-administrators) of the service should be notified when the alert is + * activated. + * @member {array} [customEmails] the list of administrator's custom email + * addresses to notify of the activation of the alert. + */ +export interface RuleEmailAction extends RuleAction { + sendToServiceOwners?: boolean; + customEmails?: string[]; +} + +/** + * @class + * Initializes a new instance of the RuleWebhookAction class. + * @constructor + * Specifies the action to post to service when the rule condition is + * evaluated. The discriminator is always RuleWebhookAction in this case. + * + * @member {string} [serviceUri] the service uri to Post the notification when + * the alert activates or resolves. + * @member {object} [properties] the dictionary of custom properties to include + * with the post operation. These data are appended to the webhook payload. + */ +export interface RuleWebhookAction extends RuleAction { + serviceUri?: string; + properties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the AlertRuleResource class. + * @constructor + * The alert rule resource. + * + * @member {string} alertRuleResourceName the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource identifier + * of the resource the rule monitors. **NOTE**: this property cannot be updated + * for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface AlertRuleResource extends Resource { + alertRuleResourceName: string; + description?: string; + isEnabled: boolean; + condition: RuleCondition; + actions?: RuleAction[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the AlertRuleResourcePatch class. + * @constructor + * The alert rule object for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} name the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource identifier + * of the resource the rule monitors. **NOTE**: this property cannot be updated + * for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface AlertRuleResourcePatch { + tags?: { [propertyName: string]: string }; + name: string; + description?: string; + isEnabled: boolean; + condition: RuleCondition; + actions?: RuleAction[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the RetentionPolicy class. + * @constructor + * Specifies the retention policy for the log. + * + * @member {boolean} enabled a value indicating whether the retention policy is + * enabled. + * @member {number} days the number of days for the retention in days. A value + * of 0 will retain the events indefinitely. + */ +export interface RetentionPolicy { + enabled: boolean; + days: number; +} + +/** + * @class + * Initializes a new instance of the LogProfileResource class. + * @constructor + * The log profile resource. + * + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories are + * created as is convenient to the user. Some values are: 'Write', 'Delete', + * and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in the + * log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface LogProfileResource extends Resource { + storageAccountId?: string; + serviceBusRuleId?: string; + locations: string[]; + categories: string[]; + retentionPolicy: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the LogProfileResourcePatch class. + * @constructor + * The log profile resource for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories are + * created as is convenient to the user. Some values are: 'Write', 'Delete', + * and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in the + * log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface LogProfileResourcePatch { + tags?: { [propertyName: string]: string }; + storageAccountId?: string; + serviceBusRuleId?: string; + locations: string[]; + categories: string[]; + retentionPolicy: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the ProxyOnlyResource class. + * @constructor + * A proxy only azure resource object + * + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + */ +export interface ProxyOnlyResource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the MetricSettings class. + * @constructor + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular metric. + * + * @member {moment.duration} [timeGrain] the timegrain of the metric in ISO8601 + * format. + * @member {string} [category] Name of a Diagnostic Metric category for a + * resource type this setting is applied to. To obtain the list of Diagnostic + * metric categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this category is + * enabled. + * @member {object} [retentionPolicy] the retention policy for this category. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface MetricSettings { + timeGrain?: moment.Duration; + category?: string; + enabled: boolean; + retentionPolicy?: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the LogSettings class. + * @constructor + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular log. + * + * @member {string} [category] Name of a Diagnostic Log category for a resource + * type this setting is applied to. To obtain the list of Diagnostic Log + * categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this log is enabled. + * @member {object} [retentionPolicy] the retention policy for this log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface LogSettings { + category?: string; + enabled: boolean; + retentionPolicy?: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsResource class. + * @constructor + * The diagnostic setting resource. + * + * @member {string} [storageAccountId] The resource ID of the storage account + * to which you would like to send Diagnostic Logs. + * @member {string} [eventHubAuthorizationRuleId] The resource Id for the event + * hub authorization rule. + * @member {string} [eventHubName] The name of the event hub. If none is + * specified, the default event hub will be selected. + * @member {array} [metrics] the list of metric settings. + * @member {array} [logs] the list of logs settings. + * @member {string} [workspaceId] The workspace ID (resource ID of a Log + * Analytics workspace) for a Log Analytics workspace to which you would like + * to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + */ +export interface DiagnosticSettingsResource extends ProxyOnlyResource { + storageAccountId?: string; + eventHubAuthorizationRuleId?: string; + eventHubName?: string; + metrics?: MetricSettings[]; + logs?: LogSettings[]; + workspaceId?: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsResourceCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + * @member {array} [value] The collection of diagnostic settings resources;. + */ +export interface DiagnosticSettingsResourceCollection { + value?: DiagnosticSettingsResource[]; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsCategoryResource class. + * @constructor + * The diagnostic settings category resource. + * + * @member {string} [categoryType] The type of the diagnostic settings + * category. Possible values include: 'Metrics', 'Logs' + */ +export interface DiagnosticSettingsCategoryResource extends ProxyOnlyResource { + categoryType?: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsCategoryResourceCollection class. + * @constructor + * Represents a collection of diagnostic setting category resources. + * + * @member {array} [value] The collection of diagnostic settings category + * resources. + */ +export interface DiagnosticSettingsCategoryResourceCollection { + value?: DiagnosticSettingsCategoryResource[]; +} + +/** + * @class + * Initializes a new instance of the EmailReceiver class. + * @constructor + * An email receiver. + * + * @member {string} name The name of the email receiver. Names must be unique + * across all receivers within an action group. + * @member {string} emailAddress The email address of this receiver. + * @member {string} [status] The receiver status of the e-mail. Possible values + * include: 'NotSpecified', 'Enabled', 'Disabled' + */ +export interface EmailReceiver { + name: string; + emailAddress: string; + readonly status?: string; +} + +/** + * @class + * Initializes a new instance of the SmsReceiver class. + * @constructor + * An SMS receiver. + * + * @member {string} name The name of the SMS receiver. Names must be unique + * across all receivers within an action group. + * @member {string} countryCode The country code of the SMS receiver. + * @member {string} phoneNumber The phone number of the SMS receiver. + * @member {string} [status] The status of the receiver. Possible values + * include: 'NotSpecified', 'Enabled', 'Disabled' + */ +export interface SmsReceiver { + name: string; + countryCode: string; + phoneNumber: string; + readonly status?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookReceiver class. + * @constructor + * A webhook receiver. + * + * @member {string} name The name of the webhook receiver. Names must be unique + * across all receivers within an action group. + * @member {string} serviceUri The URI where webhooks should be sent. + */ +export interface WebhookReceiver { + name: string; + serviceUri: string; +} + +/** + * @class + * Initializes a new instance of the ItsmReceiver class. + * @constructor + * An Itsm receiver. + * + * @member {string} name The name of the Itsm receiver. Names must be unique + * across all receivers within an action group. + * @member {string} workspaceId OMS LA instance identifier. + * @member {string} connectionId Unique identification of ITSM connection among + * multiple defined in above workspace. + * @member {string} ticketConfiguration JSON blob for the configurations of the + * ITSM action. CreateMultipleWorkItems option will be part of this blob as + * well. + * @member {string} region Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + */ +export interface ItsmReceiver { + name: string; + workspaceId: string; + connectionId: string; + ticketConfiguration: string; + region: string; +} + +/** + * @class + * Initializes a new instance of the AzureAppPushReceiver class. + * @constructor + * The Azure mobile App push notification receiver. + * + * @member {string} name The name of the Azure mobile app push receiver. Names + * must be unique across all receivers within an action group. + * @member {string} emailAddress The email address registered for the Azure + * mobile app. + */ +export interface AzureAppPushReceiver { + name: string; + emailAddress: string; +} + +/** + * @class + * Initializes a new instance of the AutomationRunbookReceiver class. + * @constructor + * The Azure Automation Runbook notification receiver. + * + * @member {string} automationAccountId The Azure automation account Id which + * holds this runbook and authenticate to Azure resource. + * @member {string} runbookName The name for this runbook. + * @member {string} webhookResourceId The resource id for webhook linked to + * this runbook. + * @member {boolean} isGlobalRunbook Indicates whether this instance is global + * runbook. + * @member {string} [name] Indicates name of the webhook. + * @member {string} [serviceUri] The URI where webhooks should be sent. + */ +export interface AutomationRunbookReceiver { + automationAccountId: string; + runbookName: string; + webhookResourceId: string; + isGlobalRunbook: boolean; + name?: string; + 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. + * @constructor + * An action group resource. + * + * @member {string} groupShortName The short name of the action group. This + * will be used in SMS messages. + * @member {boolean} enabled Indicates whether this action group is enabled. If + * an action group is not enabled, then none of its receivers will receive + * communications. Default value: true . + * @member {array} [emailReceivers] The list of email receivers that are part + * of this action group. + * @member {array} [smsReceivers] The list of SMS receivers that are part of + * this action group. + * @member {array} [webhookReceivers] The list of webhook receivers that are + * part of this action group. + * @member {array} [itsmReceivers] The list of ITSM receivers that are part of + * this action group. + * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers + * 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; + enabled: boolean; + emailReceivers?: EmailReceiver[]; + smsReceivers?: SmsReceiver[]; + webhookReceivers?: WebhookReceiver[]; + itsmReceivers?: ItsmReceiver[]; + azureAppPushReceivers?: AzureAppPushReceiver[]; + automationRunbookReceivers?: AutomationRunbookReceiver[]; + voiceReceivers?: VoiceReceiver[]; + logicAppReceivers?: LogicAppReceiver[]; + azureFunctionReceivers?: AzureFunctionReceiver[]; +} + +/** + * @class + * Initializes a new instance of the EnableRequest class. + * @constructor + * Describes a receiver that should be resubscribed. + * + * @member {string} receiverName The name of the receiver to resubscribe. + */ +export interface EnableRequest { + receiverName: string; +} + +/** + * @class + * Initializes a new instance of the ActionGroupPatchBody class. + * @constructor + * An action group object for the body of patch operations. + * + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this action group is enabled. + * If an action group is not enabled, then none of its actions will be + * activated. Default value: true . + */ +export interface ActionGroupPatchBody { + tags?: { [propertyName: string]: string }; + enabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertLeafCondition class. + * @constructor + * An Activity Log alert condition that is met by comparing an activity log + * field and value. + * + * @member {string} field The name of the field that this condition will + * examine. The possible values for this field are (case-insensitive): + * 'resourceId', 'category', 'caller', 'level', 'operationName', + * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', + * or anything beginning with 'properties.'. + * @member {string} equals The field value will be compared to this value + * (case-insensitive) to determine if the condition is met. + */ +export interface ActivityLogAlertLeafCondition { + field: string; + equals: string; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertAllOfCondition class. + * @constructor + * An Activity Log alert condition that is met when all its member conditions + * are met. + * + * @member {array} allOf The list of activity log alert conditions. + */ +export interface ActivityLogAlertAllOfCondition { + allOf: ActivityLogAlertLeafCondition[]; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertActionGroup class. + * @constructor + * A pointer to an Azure Action Group. + * + * @member {string} actionGroupId The resourceId of the action group. This + * cannot be null or empty. + * @member {object} [webhookProperties] the dictionary of custom properties to + * include with the post operation. These data are appended to the webhook + * payload. + */ +export interface ActivityLogAlertActionGroup { + actionGroupId: string; + webhookProperties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertActionList class. + * @constructor + * A list of activity log alert actions. + * + * @member {array} [actionGroups] The list of activity log alerts. + */ +export interface ActivityLogAlertActionList { + actionGroups?: ActivityLogAlertActionGroup[]; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertResource class. + * @constructor + * An activity log alert resource. + * + * @member {array} scopes A list of resourceIds that will be used as prefixes. + * The alert will only apply to activityLogs with resourceIds that fall under + * one of these prefixes. This list must include at least one item. + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + * @member {object} condition The condition that will cause this alert to + * activate. + * @member {array} [condition.allOf] The list of activity log alert conditions. + * @member {object} actions The actions that will activate when the condition + * is met. + * @member {array} [actions.actionGroups] The list of activity log alerts. + * @member {string} [description] A description of this activity log alert. + */ +export interface ActivityLogAlertResource extends Resource { + scopes: string[]; + enabled?: boolean; + condition: ActivityLogAlertAllOfCondition; + actions: ActivityLogAlertActionList; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertPatchBody class. + * @constructor + * An activity log alert object for the body of patch operations. + * + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + */ +export interface ActivityLogAlertPatchBody { + tags?: { [propertyName: string]: string }; + enabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the LocalizableString class. + * @constructor + * The localizable string class. + * + * @member {string} value the invariant value. + * @member {string} [localizedValue] the locale specific value. + */ +export interface LocalizableString { + value: string; + localizedValue?: string; +} + +/** + * @class + * Initializes a new instance of the SenderAuthorization class. + * @constructor + * the authorization used by the user who has performed the operation that led + * to this event. This captures the RBAC properties of the event. These usually + * include the 'action', 'role' and the 'scope' + * + * @member {string} [action] the permissible actions. For instance: + * microsoft.support/supporttickets/write + * @member {string} [role] the role of the user. For instance: Subscription + * Admin + * @member {string} [scope] the scope. + */ +export interface SenderAuthorization { + action?: string; + role?: string; + scope?: string; +} + +/** + * @class + * Initializes a new instance of the HttpRequestInfo class. + * @constructor + * The Http request info. + * + * @member {string} [clientRequestId] the client request id. + * @member {string} [clientIpAddress] the client Ip Address + * @member {string} [method] the Http request method. + * @member {string} [uri] the Uri. + */ +export interface HttpRequestInfo { + clientRequestId?: string; + clientIpAddress?: string; + method?: string; + uri?: string; +} + +/** + * @class + * Initializes a new instance of the EventData class. + * @constructor + * The Azure event log entries are of type EventData + * + * @member {object} [authorization] + * @member {string} [authorization.action] the permissible actions. For + * instance: microsoft.support/supporttickets/write + * @member {string} [authorization.role] the role of the user. For instance: + * Subscription Admin + * @member {string} [authorization.scope] the scope. + * @member {object} [claims] key value pairs to identify ARM permissions. + * @member {string} [caller] the email address of the user who has performed + * the operation, the UPN claim or SPN claim based on availability. + * @member {string} [description] the description of the event. + * @member {string} [id] the Id of this event as required by ARM for RBAC. It + * contains the EventDataID and a timestamp information. + * @member {string} [eventDataId] the event data Id. This is a unique + * identifier for an event. + * @member {string} [correlationId] the correlation Id, usually a GUID in the + * string format. The correlation Id is shared among the events that belong to + * the same uber operation. + * @member {object} [eventName] the event name. This value should not be + * confused with OperationName. For practical purposes, OperationName might be + * more appealing to end users. + * @member {string} [eventName.value] the invariant value. + * @member {string} [eventName.localizedValue] the locale specific value. + * @member {object} [category] the event category. + * @member {string} [category.value] the invariant value. + * @member {string} [category.localizedValue] the locale specific value. + * @member {object} [httpRequest] the HTTP request info. Usually includes the + * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated + * the event) and 'method' (HTTP method e.g. PUT). + * @member {string} [httpRequest.clientRequestId] the client request id. + * @member {string} [httpRequest.clientIpAddress] the client Ip Address + * @member {string} [httpRequest.method] the Http request method. + * @member {string} [httpRequest.uri] the Uri. + * @member {string} [level] the event level. Possible values include: + * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + * @member {string} [resourceGroupName] the resource group name of the impacted + * resource. + * @member {object} [resourceProviderName] the resource provider name of the + * impacted resource. + * @member {string} [resourceProviderName.value] the invariant value. + * @member {string} [resourceProviderName.localizedValue] the locale specific + * value. + * @member {string} [resourceId] the resource uri that uniquely identifies the + * resource that caused this event. + * @member {object} [resourceType] the resource type + * @member {string} [resourceType.value] the invariant value. + * @member {string} [resourceType.localizedValue] the locale specific value. + * @member {string} [operationId] It is usually a GUID shared among the events + * corresponding to single operation. This value should not be confused with + * EventName. + * @member {object} [operationName] the operation name. + * @member {string} [operationName.value] the invariant value. + * @member {string} [operationName.localizedValue] the locale specific value. + * @member {object} [properties] the set of pairs (usually a + * Dictionary) that includes details about the event. + * @member {object} [status] a string describing the status of the operation. + * Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + * @member {string} [status.value] the invariant value. + * @member {string} [status.localizedValue] the locale specific value. + * @member {object} [subStatus] the event sub status. Most of the time, when + * included, this captures the HTTP status code of the REST call. Common values + * are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted + * (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad + * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict + * (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), + * Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status + * Code: 504) + * @member {string} [subStatus.value] the invariant value. + * @member {string} [subStatus.localizedValue] the locale specific value. + * @member {date} [eventTimestamp] the timestamp of when the event was + * generated by the Azure service processing the request corresponding the + * event. It in ISO 8601 format. + * @member {date} [submissionTimestamp] the timestamp of when the event became + * available for querying via this API. It is in ISO 8601 format. This value + * should not be confused eventTimestamp. As there might be a delay between the + * occurrence time of the event, and the time that the event is submitted to + * the Azure logging infrastructure. + * @member {string} [subscriptionId] the Azure subscription Id usually a GUID. + * @member {string} [tenantId] the Azure tenant Id + */ +export interface EventData { + readonly authorization?: SenderAuthorization; + readonly claims?: { [propertyName: string]: string }; + readonly caller?: string; + readonly description?: string; + readonly id?: string; + readonly eventDataId?: string; + readonly correlationId?: string; + readonly eventName?: LocalizableString; + readonly category?: LocalizableString; + readonly httpRequest?: HttpRequestInfo; + readonly level?: string; + readonly resourceGroupName?: string; + readonly resourceProviderName?: LocalizableString; + readonly resourceId?: string; + readonly resourceType?: LocalizableString; + readonly operationId?: string; + readonly operationName?: LocalizableString; + readonly properties?: { [propertyName: string]: string }; + readonly status?: LocalizableString; + readonly subStatus?: LocalizableString; + readonly eventTimestamp?: Date; + readonly submissionTimestamp?: Date; + readonly subscriptionId?: string; + readonly tenantId?: string; +} + +/** + * @class + * Initializes a new instance of the MetricAvailability class. + * @constructor + * Metric availability specifies the time grain (aggregation interval or + * frequency) and the retention period for that time grain. + * + * @member {moment.duration} [timeGrain] the time grain specifies the + * aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', + * etc. + * @member {moment.duration} [retention] the retention period for the metric at + * the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + */ +export interface MetricAvailability { + timeGrain?: moment.Duration; + retention?: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the MetricDefinition class. + * @constructor + * Metric definition class specifies the metadata for a metric. + * + * @member {boolean} [isDimensionRequired] Flag to indicate whether the + * dimension is required. + * @member {string} [resourceId] the resource identifier of the resource that + * emitted the metric. + * @member {string} [namespace] the namespace the metric blongs to. + * @member {object} [name] the name and the display name of the metric, i.e. it + * is a localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [unit] the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {string} [primaryAggregationType] the primary aggregation type value + * defining how to use the values for display. Possible values include: 'None', + * 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + * @member {array} [supportedAggregationTypes] the collection of what + * aggregation types are supported. + * @member {array} [metricAvailabilities] the collection of what aggregation + * intervals are available to be queried. + * @member {string} [id] the resource identifier of the metric definition. + * @member {array} [dimensions] the name and the display name of the dimension, + * i.e. it is a localizable string. + */ +export interface MetricDefinition { + isDimensionRequired?: boolean; + resourceId?: string; + namespace?: string; + name?: LocalizableString; + unit?: string; + primaryAggregationType?: string; + supportedAggregationTypes?: string[]; + metricAvailabilities?: MetricAvailability[]; + id?: string; + dimensions?: LocalizableString[]; +} + +/** + * @class + * Initializes a new instance of the MetricValue class. + * @constructor + * Represents a metric value. + * + * @member {date} timeStamp the timestamp for the metric value in ISO 8601 + * format. + * @member {number} [average] the average value in the time range. + * @member {number} [minimum] the least value in the time range. + * @member {number} [maximum] the greatest value in the time range. + * @member {number} [total] the sum of all of the values in the time range. + * @member {number} [count] the number of samples in the time range. Can be + * used to determine the number of values that contributed to the average + * value. + */ +export interface MetricValue { + timeStamp: Date; + average?: number; + minimum?: number; + maximum?: number; + total?: number; + count?: number; +} + +/** + * @class + * Initializes a new instance of the MetadataValue class. + * @constructor + * Represents a metric metadata value. + * + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ +export interface MetadataValue { + name?: LocalizableString; + value?: string; +} + +/** + * @class + * Initializes a new instance of the TimeSeriesElement class. + * @constructor + * A time series result type. The discriminator value is always TimeSeries in + * this case. + * + * @member {array} [metadatavalues] the metadata values returned if $filter was + * specified in the call. + * @member {array} [data] An array of data points representing the metric + * values. This is only returned if a result type of data is specified. + */ +export interface TimeSeriesElement { + metadatavalues?: MetadataValue[]; + data?: MetricValue[]; +} + +/** + * @class + * Initializes a new instance of the Metric class. + * @constructor + * The result data of a query. + * + * @member {string} id the metric Id. + * @member {string} type the resource type of the metric resource. + * @member {object} name the name and the display name of the metric, i.e. it + * is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} unit the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {array} timeseries the time series returned when a data query is + * performed. + */ +export interface Metric { + id: string; + type: string; + name: LocalizableString; + unit: string; + timeseries: TimeSeriesElement[]; +} + +/** + * @class + * Initializes a new instance of the Response class. + * @constructor + * The response to a metrics query. + * + * @member {number} [cost] The integer value representing the cost of the + * query, for data case. + * @member {string} timespan The timespan for which the data was retrieved. Its + * value consists of two datatimes concatenated, separated by '/'. This may be + * adjusted in the future and returned back from what was originally requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if a + * metadata request was made. + * @member {string} [namespace] The namespace of the metrics been queried + * @member {string} [resourceregion] The region of the resource been queried + * for metrics. + * @member {array} value the value of the collection. + */ +export interface Response { + cost?: number; + timespan: string; + interval?: moment.Duration; + namespace?: string; + resourceregion?: string; + value: Metric[]; +} + +/** + * @class + * Initializes a new instance of the BaselineMetadataValue class. + * @constructor + * Represents a baseline metadata value. + * + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ +export interface BaselineMetadataValue { + name?: LocalizableString; + value?: string; +} + +/** + * @class + * Initializes a new instance of the Baseline class. + * @constructor + * The baseline values for a single sensitivity value. + * + * @member {string} sensitivity the sensitivity of the baseline. Possible + * values include: 'Low', 'Medium', 'High' + * @member {array} lowThresholds The low thresholds of the baseline. + * @member {array} highThresholds The high thresholds of the baseline. + */ +export interface Baseline { + sensitivity: string; + lowThresholds: number[]; + highThresholds: number[]; +} + +/** + * @class + * Initializes a new instance of the BaselineResponse class. + * @constructor + * The response to a baseline query. + * + * @member {string} [id] the metric baseline Id. + * @member {string} [type] the resource type of the baseline resource. + * @member {object} [name] the name and the display name of the metric, i.e. it + * is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [timespan] The timespan for which the data was retrieved. + * Its value consists of two datatimes concatenated, separated by '/'. This + * may be adjusted in the future and returned back from what was originally + * requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if a + * metadata request was made. + * @member {string} [aggregation] The aggregation type of the metric. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} [baseline] the baseline values for each sensitivity. + * @member {array} [metadata] the baseline metadata values. + */ +export interface BaselineResponse { + readonly id?: string; + readonly type?: string; + readonly name?: LocalizableString; + timespan?: string; + interval?: moment.Duration; + aggregation?: string; + timestamps?: Date[]; + baseline?: Baseline[]; + metadata?: BaselineMetadataValue[]; +} + +/** + * @class + * Initializes a new instance of the TimeSeriesInformation class. + * @constructor + * The time series info needed for calculating the baseline. + * + * @member {array} sensitivities the list of sensitivities for calculating the + * baseline. + * @member {array} values The metric values to calculate the baseline. + * @member {array} [timestamps] the array of timestamps of the baselines. + */ +export interface TimeSeriesInformation { + sensitivities: string[]; + values: number[]; + timestamps?: Date[]; +} + +/** + * @class + * Initializes a new instance of the CalculateBaselineResponse class. + * @constructor + * The response to a calcualte baseline call. + * + * @member {string} type the resource type of the baseline resource. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} baseline the baseline values for each sensitivity. + */ +export interface CalculateBaselineResponse { + type: string; + timestamps?: Date[]; + baseline: Baseline[]; +} + +/** + * @class + * Initializes a new instance of the Action class. + * @constructor + * An alert action. + * + * @member {string} [actionGroupId] the id of the action group to use. + * @member {object} [webhookProperties] + */ +export interface Action { + actionGroupId?: string; + webhookProperties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the MetricAlertCriteria class. + * @constructor + * The rule criteria that defines the conditions of the alert rule. + * + * @member {string} odatatype Polymorphic Discriminator + */ +export interface MetricAlertCriteria { + odatatype: string; + /** + * @property Describes unknown properties. The value of an unknown property + * can be of "any" type. + */ + [property: string]: any; +} + +/** + * @class + * Initializes a new instance of the MetricAlertResource class. + * @constructor + * The metric alert resource. + * + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert is + * scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert is + * evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface MetricAlertResource extends Resource { + description: string; + severity: number; + enabled: boolean; + scopes?: string[]; + evaluationFrequency: moment.Duration; + windowSize: moment.Duration; + criteria: MetricAlertCriteria; + actions?: Action[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the MetricAlertResourcePatch class. + * @constructor + * The metric alert resource for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert is + * scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert is + * evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface MetricAlertResourcePatch { + tags?: { [propertyName: string]: string }; + description: string; + severity: number; + enabled: boolean; + scopes?: string[]; + evaluationFrequency: moment.Duration; + windowSize: moment.Duration; + criteria: MetricAlertCriteria; + actions?: Action[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the MetricAlertStatusProperties class. + * @constructor + * An alert status properties. + * + * @member {object} [dimensions] + * @member {string} [status] status value + * @member {date} [timestamp] UTC time when the status was checked. + */ +export interface MetricAlertStatusProperties { + dimensions?: { [propertyName: string]: string }; + status?: string; + timestamp?: Date; +} + +/** + * @class + * Initializes a new instance of the MetricAlertStatus class. + * @constructor + * An alert status. + * + * @member {string} [name] The status name. + * @member {string} [id] The alert rule arm id. + * @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 {string} [properties.status] status value + * @member {date} [properties.timestamp] UTC time when the status was checked. + */ +export interface MetricAlertStatus { + name?: string; + id?: string; + type?: string; + properties?: MetricAlertStatusProperties; +} + +/** + * @class + * Initializes a new instance of the MetricAlertStatusCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + * @member {array} [value] the values for the alert rule resources. + */ +export interface MetricAlertStatusCollection { + value?: MetricAlertStatus[]; +} + +/** + * @class + * Initializes a new instance of the MetricDimension class. + * @constructor + * @member {string} name Name of the dimension. + * @member {string} operator the dimension operator. + * @member {array} values list of dimension values. + */ +export interface MetricDimension { + name: string; + operator: string; + values: string[]; +} + +/** + * @class + * Initializes a new instance of the MetricCriteria class. + * @constructor + * @member {string} name Name of the criteria. + * @member {string} metricName Name of the metric. + * @member {string} [metricNamespace] Namespace of the metric. + * @member {object} operator the criteria operator. + * @member {object} timeAggregation the criteria time aggregation types. + * @member {number} threshold the criteria threshold value that activates the + * alert. + * @member {array} [dimensions] List of dimension conditions. + */ +export interface MetricCriteria { + name: string; + metricName: string; + metricNamespace?: string; + operator: any; + timeAggregation: any; + threshold: number; + dimensions?: MetricDimension[]; +} + +/** + * @class + * Initializes a new instance of the MetricAlertSingleResourceMultipleMetricCriteria class. + * @constructor + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + * + * @member {array} [allOf] The list of metric criteria for this 'all of' + * operation. + */ +export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + allOf?: MetricCriteria[]; +} + + +/** + * @class + * Initializes a new instance of the AutoscaleSettingResourceCollection class. + * @constructor + * Represents a collection of autoscale setting resources. + * + * @member {string} [nextLink] URL to get the next set of results. + */ +export interface AutoscaleSettingResourceCollection extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the IncidentListResult class. + * @constructor + * The List incidents operation response. + * + */ +export interface IncidentListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the AlertRuleResourceCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + */ +export interface AlertRuleResourceCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the LogProfileCollection class. + * @constructor + * Represents a collection of log profiles. + * + */ +export interface LogProfileCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the ActionGroupList class. + * @constructor + * A list of action groups. + * + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ +export interface ActionGroupList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertList class. + * @constructor + * A list of activity log alerts. + * + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ +export interface ActivityLogAlertList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EventDataCollection class. + * @constructor + * Represents collection of events. + * + * @member {string} [nextLink] Provides the link to retrieve the next set of + * events. + */ +export interface EventDataCollection extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EventCategoryCollection class. + * @constructor + * A collection of event categories. Currently possible values are: + * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + */ +export interface EventCategoryCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the MetricDefinitionCollection class. + * @constructor + * Represents collection of metric definitions. + * + */ +export interface MetricDefinitionCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the MetricAlertResourceCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + */ +export interface MetricAlertResourceCollection extends Array { +} diff --git a/lib/services/monitor/lib/lib/models/index.js b/lib/services/monitor/lib/lib/models/index.js new file mode 100644 index 0000000000..878adabbd3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/index.js @@ -0,0 +1,131 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.Resource = require('./resource'); +exports.ScaleCapacity = require('./scaleCapacity'); +exports.MetricTrigger = require('./metricTrigger'); +exports.ScaleAction = require('./scaleAction'); +exports.ScaleRule = require('./scaleRule'); +exports.TimeWindow = require('./timeWindow'); +exports.RecurrentSchedule = require('./recurrentSchedule'); +exports.Recurrence = require('./recurrence'); +exports.AutoscaleProfile = require('./autoscaleProfile'); +exports.EmailNotification = require('./emailNotification'); +exports.WebhookNotification = require('./webhookNotification'); +exports.AutoscaleNotification = require('./autoscaleNotification'); +exports.AutoscaleSettingResource = require('./autoscaleSettingResource'); +exports.AutoscaleSettingResourcePatch = require('./autoscaleSettingResourcePatch'); +exports.ErrorResponse = require('./errorResponse'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.OperationListResult = require('./operationListResult'); +exports.Incident = require('./incident'); +exports.RuleDataSource = require('./ruleDataSource'); +exports.RuleCondition = require('./ruleCondition'); +exports.RuleMetricDataSource = require('./ruleMetricDataSource'); +exports.RuleManagementEventClaimsDataSource = require('./ruleManagementEventClaimsDataSource'); +exports.RuleManagementEventDataSource = require('./ruleManagementEventDataSource'); +exports.ThresholdRuleCondition = require('./thresholdRuleCondition'); +exports.LocationThresholdRuleCondition = require('./locationThresholdRuleCondition'); +exports.ManagementEventAggregationCondition = require('./managementEventAggregationCondition'); +exports.ManagementEventRuleCondition = require('./managementEventRuleCondition'); +exports.RuleAction = require('./ruleAction'); +exports.RuleEmailAction = require('./ruleEmailAction'); +exports.RuleWebhookAction = require('./ruleWebhookAction'); +exports.AlertRuleResource = require('./alertRuleResource'); +exports.AlertRuleResourcePatch = require('./alertRuleResourcePatch'); +exports.RetentionPolicy = require('./retentionPolicy'); +exports.LogProfileResource = require('./logProfileResource'); +exports.LogProfileResourcePatch = require('./logProfileResourcePatch'); +exports.ProxyOnlyResource = require('./proxyOnlyResource'); +exports.MetricSettings = require('./metricSettings'); +exports.LogSettings = require('./logSettings'); +exports.DiagnosticSettingsResource = require('./diagnosticSettingsResource'); +exports.DiagnosticSettingsResourceCollection = require('./diagnosticSettingsResourceCollection'); +exports.DiagnosticSettingsCategoryResource = require('./diagnosticSettingsCategoryResource'); +exports.DiagnosticSettingsCategoryResourceCollection = require('./diagnosticSettingsCategoryResourceCollection'); +exports.EmailReceiver = require('./emailReceiver'); +exports.SmsReceiver = require('./smsReceiver'); +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'); +exports.ActivityLogAlertLeafCondition = require('./activityLogAlertLeafCondition'); +exports.ActivityLogAlertAllOfCondition = require('./activityLogAlertAllOfCondition'); +exports.ActivityLogAlertActionGroup = require('./activityLogAlertActionGroup'); +exports.ActivityLogAlertActionList = require('./activityLogAlertActionList'); +exports.ActivityLogAlertResource = require('./activityLogAlertResource'); +exports.ActivityLogAlertPatchBody = require('./activityLogAlertPatchBody'); +exports.LocalizableString = require('./localizableString'); +exports.SenderAuthorization = require('./senderAuthorization'); +exports.HttpRequestInfo = require('./httpRequestInfo'); +exports.EventData = require('./eventData'); +exports.MetricAvailability = require('./metricAvailability'); +exports.MetricDefinition = require('./metricDefinition'); +exports.MetricValue = require('./metricValue'); +exports.MetadataValue = require('./metadataValue'); +exports.TimeSeriesElement = require('./timeSeriesElement'); +exports.Metric = require('./metric'); +exports.Response = require('./response'); +exports.BaselineMetadataValue = require('./baselineMetadataValue'); +exports.Baseline = require('./baseline'); +exports.BaselineResponse = require('./baselineResponse'); +exports.TimeSeriesInformation = require('./timeSeriesInformation'); +exports.CalculateBaselineResponse = require('./calculateBaselineResponse'); +exports.Action = require('./action'); +exports.MetricAlertCriteria = require('./metricAlertCriteria'); +exports.MetricAlertResource = require('./metricAlertResource'); +exports.MetricAlertResourcePatch = require('./metricAlertResourcePatch'); +exports.MetricAlertStatusProperties = require('./metricAlertStatusProperties'); +exports.MetricAlertStatus = require('./metricAlertStatus'); +exports.MetricAlertStatusCollection = require('./metricAlertStatusCollection'); +exports.MetricDimension = require('./metricDimension'); +exports.MetricCriteria = require('./metricCriteria'); +exports.MetricAlertSingleResourceMultipleMetricCriteria = require('./metricAlertSingleResourceMultipleMetricCriteria'); +exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); +exports.IncidentListResult = require('./incidentListResult'); +exports.AlertRuleResourceCollection = require('./alertRuleResourceCollection'); +exports.LogProfileCollection = require('./logProfileCollection'); +exports.ActionGroupList = require('./actionGroupList'); +exports.ActivityLogAlertList = require('./activityLogAlertList'); +exports.EventDataCollection = require('./eventDataCollection'); +exports.EventCategoryCollection = require('./eventCategoryCollection'); +exports.MetricDefinitionCollection = require('./metricDefinitionCollection'); +exports.MetricAlertResourceCollection = require('./metricAlertResourceCollection'); +exports.discriminators = { + 'RuleDataSource' : exports.RuleDataSource, + 'RuleCondition' : exports.RuleCondition, + 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' : exports.RuleMetricDataSource, + 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' : exports.RuleManagementEventDataSource, + 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' : exports.ThresholdRuleCondition, + 'RuleCondition.Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' : exports.LocationThresholdRuleCondition, + 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' : exports.ManagementEventRuleCondition, + 'RuleAction' : exports.RuleAction, + '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 +}; diff --git a/lib/services/monitor/lib/lib/models/itsmReceiver.js b/lib/services/monitor/lib/lib/models/itsmReceiver.js new file mode 100644 index 0000000000..a46c94b4d3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/itsmReceiver.js @@ -0,0 +1,89 @@ +/* + * 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 Itsm receiver. + * + */ +class ItsmReceiver { + /** + * Create a ItsmReceiver. + * @member {string} name The name of the Itsm receiver. Names must be unique + * across all receivers within an action group. + * @member {string} workspaceId OMS LA instance identifier. + * @member {string} connectionId Unique identification of ITSM connection + * among multiple defined in above workspace. + * @member {string} ticketConfiguration JSON blob for the configurations of + * the ITSM action. CreateMultipleWorkItems option will be part of this blob + * as well. + * @member {string} region Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + */ + constructor() { + } + + /** + * Defines the metadata of ItsmReceiver + * + * @returns {object} metadata of ItsmReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'ItsmReceiver', + type: { + name: 'Composite', + className: 'ItsmReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + workspaceId: { + required: true, + serializedName: 'workspaceId', + type: { + name: 'String' + } + }, + connectionId: { + required: true, + serializedName: 'connectionId', + type: { + name: 'String' + } + }, + ticketConfiguration: { + required: true, + serializedName: 'ticketConfiguration', + type: { + name: 'String' + } + }, + region: { + required: true, + serializedName: 'region', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ItsmReceiver; diff --git a/lib/services/monitor/lib/lib/models/localizableString.js b/lib/services/monitor/lib/lib/models/localizableString.js new file mode 100644 index 0000000000..357dc90351 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/localizableString.js @@ -0,0 +1,60 @@ +/* + * 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 localizable string class. + * + */ +class LocalizableString { + /** + * Create a LocalizableString. + * @member {string} value the invariant value. + * @member {string} [localizedValue] the locale specific value. + */ + constructor() { + } + + /** + * Defines the metadata of LocalizableString + * + * @returns {object} metadata of LocalizableString + * + */ + mapper() { + return { + required: false, + serializedName: 'LocalizableString', + type: { + name: 'Composite', + className: 'LocalizableString', + modelProperties: { + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + localizedValue: { + required: false, + serializedName: 'localizedValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LocalizableString; diff --git a/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js new file mode 100644 index 0000000000..c432f200c8 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js @@ -0,0 +1,96 @@ +/* + * 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'); + +/** + * A rule condition based on a certain number of locations failing. + * + * @extends models['RuleCondition'] + */ +class LocationThresholdRuleCondition extends models['RuleCondition'] { + /** + * Create a LocationThresholdRuleCondition. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {number} failedLocationCount the number of locations that must + * fail to activate the alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LocationThresholdRuleCondition + * + * @returns {object} metadata of LocationThresholdRuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'LocationThresholdRuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + windowSize: { + required: false, + serializedName: 'windowSize', + type: { + name: 'TimeSpan' + } + }, + failedLocationCount: { + required: true, + serializedName: 'failedLocationCount', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = LocationThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/logProfileCollection.js b/lib/services/monitor/lib/lib/models/logProfileCollection.js new file mode 100644 index 0000000000..d2530db617 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logProfileCollection.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 profiles. + */ +class LogProfileCollection extends Array { + /** + * Create a LogProfileCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogProfileCollection + * + * @returns {object} metadata of LogProfileCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'LogProfileCollection', + type: { + name: 'Composite', + className: 'LogProfileCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogProfileResourceElementType', + type: { + name: 'Composite', + className: 'LogProfileResource' + } + } + } + } + } + } + }; + } +} + +module.exports = LogProfileCollection; diff --git a/lib/services/monitor/lib/lib/models/logProfileResource.js b/lib/services/monitor/lib/lib/models/logProfileResource.js new file mode 100644 index 0000000000..69a8f54034 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logProfileResource.js @@ -0,0 +1,161 @@ +/* + * 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 profile resource. + * + * @extends models['Resource'] + */ +class LogProfileResource extends models['Resource'] { + /** + * Create a LogProfileResource. + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories + * are created as is convenient to the user. Some values are: 'Write', + * 'Delete', and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in + * the log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogProfileResource + * + * @returns {object} metadata of LogProfileResource + * + */ + mapper() { + return { + required: false, + serializedName: 'LogProfileResource', + type: { + name: 'Composite', + className: 'LogProfileResource', + 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' + } + } + } + }, + storageAccountId: { + required: false, + serializedName: 'properties.storageAccountId', + type: { + name: 'String' + } + }, + serviceBusRuleId: { + required: false, + serializedName: 'properties.serviceBusRuleId', + type: { + name: 'String' + } + }, + locations: { + required: true, + serializedName: 'properties.locations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + categories: { + required: true, + serializedName: 'properties.categories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + retentionPolicy: { + required: true, + serializedName: 'properties.retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = LogProfileResource; diff --git a/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js b/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js new file mode 100644 index 0000000000..f9b2822b45 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js @@ -0,0 +1,129 @@ +/* + * 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 profile resource for patch operations. + * + */ +class LogProfileResourcePatch { + /** + * Create a LogProfileResourcePatch. + * @member {object} [tags] Resource tags + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories + * are created as is convenient to the user. Some values are: 'Write', + * 'Delete', and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in + * the log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of LogProfileResourcePatch + * + * @returns {object} metadata of LogProfileResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'LogProfileResourcePatch', + type: { + name: 'Composite', + className: 'LogProfileResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + storageAccountId: { + required: false, + serializedName: 'properties.storageAccountId', + type: { + name: 'String' + } + }, + serviceBusRuleId: { + required: false, + serializedName: 'properties.serviceBusRuleId', + type: { + name: 'String' + } + }, + locations: { + required: true, + serializedName: 'properties.locations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + categories: { + required: true, + serializedName: 'properties.categories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + retentionPolicy: { + required: true, + serializedName: 'properties.retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = LogProfileResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/logSettings.js b/lib/services/monitor/lib/lib/models/logSettings.js new file mode 100644 index 0000000000..de7aa7b6c6 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logSettings.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'; + +const models = require('./index'); + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular log. + * + */ +class LogSettings { + /** + * Create a LogSettings. + * @member {string} [category] Name of a Diagnostic Log category for a + * resource type this setting is applied to. To obtain the list of Diagnostic + * Log categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this log is enabled. + * @member {object} [retentionPolicy] the retention policy for this log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of LogSettings + * + * @returns {object} metadata of LogSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSettings', + type: { + name: 'Composite', + className: 'LogSettings', + modelProperties: { + category: { + required: false, + serializedName: 'category', + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + retentionPolicy: { + required: false, + serializedName: 'retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = LogSettings; diff --git a/lib/services/monitor/lib/lib/models/logicAppReceiver.js b/lib/services/monitor/lib/lib/models/logicAppReceiver.js new file mode 100644 index 0000000000..9e7a9f1a52 --- /dev/null +++ b/lib/services/monitor/lib/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/monitor/lib/lib/models/managementEventAggregationCondition.js b/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js new file mode 100644 index 0000000000..29aa3f55f9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * How the data that is collected should be combined over time. + * + */ +class ManagementEventAggregationCondition { + /** + * Create a ManagementEventAggregationCondition. + * @member {string} [operator] the condition operator. Possible values + * include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [threshold] The threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + */ + constructor() { + } + + /** + * Defines the metadata of ManagementEventAggregationCondition + * + * @returns {object} metadata of ManagementEventAggregationCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementEventAggregationCondition', + type: { + name: 'Composite', + className: 'ManagementEventAggregationCondition', + modelProperties: { + operator: { + required: false, + serializedName: 'operator', + type: { + name: 'Enum', + allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] + } + }, + threshold: { + required: false, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + windowSize: { + required: false, + serializedName: 'windowSize', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = ManagementEventAggregationCondition; diff --git a/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js b/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js new file mode 100644 index 0000000000..d06bfc5742 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js @@ -0,0 +1,94 @@ +/* + * 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'); + +/** + * A management event rule condition. + * + * @extends models['RuleCondition'] + */ +class ManagementEventRuleCondition extends models['RuleCondition'] { + /** + * Create a ManagementEventRuleCondition. + * @member {object} [aggregation] How the data that is collected should be + * combined over time and when the alert is activated. Note that for + * management event alerts aggregation is optional – if it is not provided + * then any event will cause the alert to activate. + * @member {string} [aggregation.operator] the condition operator. Possible + * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [aggregation.threshold] The threshold value that + * activates the alert. + * @member {moment.duration} [aggregation.windowSize] the period of time (in + * ISO 8601 duration format) that is used to monitor alert activity based on + * the threshold. If specified then it must be between 5 minutes and 1 day. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagementEventRuleCondition + * + * @returns {object} metadata of ManagementEventRuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'ManagementEventRuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + aggregation: { + required: false, + serializedName: 'aggregation', + type: { + name: 'Composite', + className: 'ManagementEventAggregationCondition' + } + } + } + } + }; + } +} + +module.exports = ManagementEventRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/metadataValue.js b/lib/services/monitor/lib/lib/models/metadataValue.js new file mode 100644 index 0000000000..e57162fef2 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metadataValue.js @@ -0,0 +1,65 @@ +/* + * 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'); + +/** + * Represents a metric metadata value. + * + */ +class MetadataValue { + /** + * Create a MetadataValue. + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ + constructor() { + } + + /** + * Defines the metadata of MetadataValue + * + * @returns {object} metadata of MetadataValue + * + */ + mapper() { + return { + required: false, + serializedName: 'MetadataValue', + type: { + name: 'Composite', + className: 'MetadataValue', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MetadataValue; diff --git a/lib/services/monitor/lib/lib/models/metric.js b/lib/services/monitor/lib/lib/models/metric.js new file mode 100644 index 0000000000..62f4e00afc --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metric.js @@ -0,0 +1,102 @@ +/* + * 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 result data of a query. + * + */ +class Metric { + /** + * Create a Metric. + * @member {string} id the metric Id. + * @member {string} type the resource type of the metric resource. + * @member {object} name the name and the display name of the metric, i.e. it + * is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} unit the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {array} timeseries the time series returned when a data query is + * performed. + */ + constructor() { + } + + /** + * Defines the metadata of Metric + * + * @returns {object} metadata of Metric + * + */ + mapper() { + return { + required: false, + serializedName: 'Metric', + type: { + name: 'Composite', + className: 'Metric', + modelProperties: { + id: { + required: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + unit: { + required: true, + serializedName: 'unit', + type: { + name: 'Enum', + allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] + } + }, + timeseries: { + required: true, + serializedName: 'timeseries', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TimeSeriesElementElementType', + type: { + name: 'Composite', + className: 'TimeSeriesElement' + } + } + } + } + } + } + }; + } +} + +module.exports = Metric; diff --git a/lib/services/monitor/lib/lib/models/metricAlertCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertCriteria.js new file mode 100644 index 0000000000..1a423dbb2d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertCriteria.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'; + +/** + * The rule criteria that defines the conditions of the alert rule. + * + */ +class MetricAlertCriteria { + /** + * Create a MetricAlertCriteria. + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertCriteria + * + * @returns {object} metadata of MetricAlertCriteria + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertCriteria', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + }, + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertCriteria', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MetricAlertCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResource.js b/lib/services/monitor/lib/lib/models/metricAlertResource.js new file mode 100644 index 0000000000..c21174220c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertResource.js @@ -0,0 +1,208 @@ +/* + * 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 metric alert resource. + * + * @extends models['Resource'] + */ +class MetricAlertResource extends models['Resource'] { + /** + * Create a MetricAlertResource. + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert + * is scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert + * is evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricAlertResource + * + * @returns {object} metadata of MetricAlertResource + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertResource', + type: { + name: 'Composite', + className: 'MetricAlertResource', + 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: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + severity: { + required: true, + serializedName: 'properties.severity', + type: { + name: 'Number' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + type: { + name: 'Boolean' + } + }, + scopes: { + required: false, + serializedName: 'properties.scopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + evaluationFrequency: { + required: true, + serializedName: 'properties.evaluationFrequency', + type: { + name: 'TimeSpan' + } + }, + windowSize: { + required: true, + serializedName: 'properties.windowSize', + type: { + name: 'TimeSpan' + } + }, + criteria: { + required: true, + serializedName: 'properties.criteria', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + }, + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertCriteria' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + className: 'Action' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = MetricAlertResource; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js b/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js new file mode 100644 index 0000000000..4e54250e8c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.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 alert rule resources. + */ +class MetricAlertResourceCollection extends Array { + /** + * Create a MetricAlertResourceCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricAlertResourceCollection + * + * @returns {object} metadata of MetricAlertResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertResourceCollection', + type: { + name: 'Composite', + className: 'MetricAlertResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAlertResourceElementType', + type: { + name: 'Composite', + className: 'MetricAlertResource' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js b/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js new file mode 100644 index 0000000000..1832373f2d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js @@ -0,0 +1,176 @@ +/* + * 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 metric alert resource for patch operations. + * + */ +class MetricAlertResourcePatch { + /** + * Create a MetricAlertResourcePatch. + * @member {object} [tags] Resource tags + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert + * is scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert + * is evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertResourcePatch + * + * @returns {object} metadata of MetricAlertResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertResourcePatch', + type: { + name: 'Composite', + className: 'MetricAlertResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + description: { + required: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + severity: { + required: true, + serializedName: 'properties.severity', + type: { + name: 'Number' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + type: { + name: 'Boolean' + } + }, + scopes: { + required: false, + serializedName: 'properties.scopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + evaluationFrequency: { + required: true, + serializedName: 'properties.evaluationFrequency', + type: { + name: 'TimeSpan' + } + }, + windowSize: { + required: true, + serializedName: 'properties.windowSize', + type: { + name: 'TimeSpan' + } + }, + criteria: { + required: true, + serializedName: 'properties.criteria', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + }, + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertCriteria' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + className: 'Action' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = MetricAlertResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js new file mode 100644 index 0000000000..99a72bf055 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.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'; + +const models = require('./index'); + +/** + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + * + * @extends models['MetricAlertCriteria'] + */ +class MetricAlertSingleResourceMultipleMetricCriteria extends models['MetricAlertCriteria'] { + /** + * Create a MetricAlertSingleResourceMultipleMetricCriteria. + * @member {array} [allOf] The list of metric criteria for this 'all of' + * operation. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricAlertSingleResourceMultipleMetricCriteria + * + * @returns {object} metadata of MetricAlertSingleResourceMultipleMetricCriteria + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertSingleResourceMultipleMetricCriteria', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + allOf: { + required: false, + serializedName: 'allOf', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricCriteriaElementType', + type: { + name: 'Composite', + className: 'MetricCriteria' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertSingleResourceMultipleMetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatus.js b/lib/services/monitor/lib/lib/models/metricAlertStatus.js new file mode 100644 index 0000000000..6df29691be --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertStatus.js @@ -0,0 +1,84 @@ +/* + * 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'); + +/** + * An alert status. + * + */ +class MetricAlertStatus { + /** + * Create a MetricAlertStatus. + * @member {string} [name] The status name. + * @member {string} [id] The alert rule arm id. + * @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 {string} [properties.status] status value + * @member {date} [properties.timestamp] UTC time when the status was + * checked. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertStatus + * + * @returns {object} metadata of MetricAlertStatus + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertStatus', + type: { + name: 'Composite', + className: 'MetricAlertStatus', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'MetricAlertStatusProperties' + } + } + } + } + }; + } +} + +module.exports = MetricAlertStatus; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js b/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js new file mode 100644 index 0000000000..e3679d730b --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js @@ -0,0 +1,62 @@ +/* + * 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'); + +/** + * Represents a collection of alert rule resources. + * + */ +class MetricAlertStatusCollection { + /** + * Create a MetricAlertStatusCollection. + * @member {array} [value] the values for the alert rule resources. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertStatusCollection + * + * @returns {object} metadata of MetricAlertStatusCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertStatusCollection', + type: { + name: 'Composite', + className: 'MetricAlertStatusCollection', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAlertStatusElementType', + type: { + name: 'Composite', + className: 'MetricAlertStatus' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertStatusCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js b/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js new file mode 100644 index 0000000000..b9581c6cda --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js @@ -0,0 +1,75 @@ +/* + * 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 status properties. + * + */ +class MetricAlertStatusProperties { + /** + * Create a MetricAlertStatusProperties. + * @member {object} [dimensions] + * @member {string} [status] status value + * @member {date} [timestamp] UTC time when the status was checked. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertStatusProperties + * + * @returns {object} metadata of MetricAlertStatusProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertStatusProperties', + type: { + name: 'Composite', + className: 'MetricAlertStatusProperties', + modelProperties: { + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + timestamp: { + required: false, + serializedName: 'timestamp', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = MetricAlertStatusProperties; diff --git a/lib/services/monitor/lib/lib/models/metricAvailability.js b/lib/services/monitor/lib/lib/models/metricAvailability.js new file mode 100644 index 0000000000..b8374a22c0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAvailability.js @@ -0,0 +1,64 @@ +/* + * 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'; + +/** + * Metric availability specifies the time grain (aggregation interval or + * frequency) and the retention period for that time grain. + * + */ +class MetricAvailability { + /** + * Create a MetricAvailability. + * @member {moment.duration} [timeGrain] the time grain specifies the + * aggregation interval for the metric. Expressed as a duration 'PT1M', + * 'P1D', etc. + * @member {moment.duration} [retention] the retention period for the metric + * at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAvailability + * + * @returns {object} metadata of MetricAvailability + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAvailability', + type: { + name: 'Composite', + className: 'MetricAvailability', + modelProperties: { + timeGrain: { + required: false, + serializedName: 'timeGrain', + type: { + name: 'TimeSpan' + } + }, + retention: { + required: false, + serializedName: 'retention', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = MetricAvailability; diff --git a/lib/services/monitor/lib/lib/models/metricCriteria.js b/lib/services/monitor/lib/lib/models/metricCriteria.js new file mode 100644 index 0000000000..19192dc18a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricCriteria.js @@ -0,0 +1,110 @@ +/* + * 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'); + +/** + * Class representing a MetricCriteria. + */ +class MetricCriteria { + /** + * Create a MetricCriteria. + * @member {string} name Name of the criteria. + * @member {string} metricName Name of the metric. + * @member {string} [metricNamespace] Namespace of the metric. + * @member {object} operator the criteria operator. + * @member {object} timeAggregation the criteria time aggregation types. + * @member {number} threshold the criteria threshold value that activates the + * alert. + * @member {array} [dimensions] List of dimension conditions. + */ + constructor() { + } + + /** + * Defines the metadata of MetricCriteria + * + * @returns {object} metadata of MetricCriteria + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricCriteria', + type: { + name: 'Composite', + className: 'MetricCriteria', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + metricName: { + required: true, + serializedName: 'metricName', + type: { + name: 'String' + } + }, + metricNamespace: { + required: false, + serializedName: 'metricNamespace', + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'Object' + } + }, + timeAggregation: { + required: true, + serializedName: 'timeAggregation', + type: { + name: 'Object' + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricDimensionElementType', + type: { + name: 'Composite', + className: 'MetricDimension' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricDefinition.js b/lib/services/monitor/lib/lib/models/metricDefinition.js new file mode 100644 index 0000000000..06e73cee86 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricDefinition.js @@ -0,0 +1,165 @@ +/* + * 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'); + +/** + * Metric definition class specifies the metadata for a metric. + * + */ +class MetricDefinition { + /** + * Create a MetricDefinition. + * @member {boolean} [isDimensionRequired] Flag to indicate whether the + * dimension is required. + * @member {string} [resourceId] the resource identifier of the resource that + * emitted the metric. + * @member {string} [namespace] the namespace the metric blongs to. + * @member {object} [name] the name and the display name of the metric, i.e. + * it is a localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [unit] the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {string} [primaryAggregationType] the primary aggregation type + * value defining how to use the values for display. Possible values include: + * 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + * @member {array} [supportedAggregationTypes] the collection of what + * aggregation types are supported. + * @member {array} [metricAvailabilities] the collection of what aggregation + * intervals are available to be queried. + * @member {string} [id] the resource identifier of the metric definition. + * @member {array} [dimensions] the name and the display name of the + * dimension, i.e. it is a localizable string. + */ + constructor() { + } + + /** + * Defines the metadata of MetricDefinition + * + * @returns {object} metadata of MetricDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDefinition', + type: { + name: 'Composite', + className: 'MetricDefinition', + modelProperties: { + isDimensionRequired: { + required: false, + serializedName: 'isDimensionRequired', + type: { + name: 'Boolean' + } + }, + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + namespace: { + required: false, + serializedName: 'namespace', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'Enum', + allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] + } + }, + primaryAggregationType: { + required: false, + serializedName: 'primaryAggregationType', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] + } + }, + supportedAggregationTypes: { + required: false, + serializedName: 'supportedAggregationTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AggregationTypeElementType', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] + } + } + } + }, + metricAvailabilities: { + required: false, + serializedName: 'metricAvailabilities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAvailabilityElementType', + type: { + name: 'Composite', + className: 'MetricAvailability' + } + } + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LocalizableStringElementType', + type: { + name: 'Composite', + className: 'LocalizableString' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricDefinition; diff --git a/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js b/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js new file mode 100644 index 0000000000..e6466e922a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricDefinitionCollection.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 collection of metric definitions. + */ +class MetricDefinitionCollection extends Array { + /** + * Create a MetricDefinitionCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricDefinitionCollection + * + * @returns {object} metadata of MetricDefinitionCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDefinitionCollection', + type: { + name: 'Composite', + className: 'MetricDefinitionCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricDefinitionElementType', + type: { + name: 'Composite', + className: 'MetricDefinition' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricDefinitionCollection; diff --git a/lib/services/monitor/lib/lib/models/metricDimension.js b/lib/services/monitor/lib/lib/models/metricDimension.js new file mode 100644 index 0000000000..4805da9870 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricDimension.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a MetricDimension. + */ +class MetricDimension { + /** + * Create a MetricDimension. + * @member {string} name Name of the dimension. + * @member {string} operator the dimension operator. + * @member {array} values list of dimension values. + */ + constructor() { + } + + /** + * Defines the metadata of MetricDimension + * + * @returns {object} metadata of MetricDimension + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDimension', + type: { + name: 'Composite', + className: 'MetricDimension', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'String' + } + }, + values: { + required: true, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricDimension; diff --git a/lib/services/monitor/lib/lib/models/metricSettings.js b/lib/services/monitor/lib/lib/models/metricSettings.js new file mode 100644 index 0000000000..bdde9809ff --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricSettings.js @@ -0,0 +1,89 @@ +/* + * 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'); + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular metric. + * + */ +class MetricSettings { + /** + * Create a MetricSettings. + * @member {moment.duration} [timeGrain] the timegrain of the metric in + * ISO8601 format. + * @member {string} [category] Name of a Diagnostic Metric category for a + * resource type this setting is applied to. To obtain the list of Diagnostic + * metric categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this category is + * enabled. + * @member {object} [retentionPolicy] the retention policy for this category. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of MetricSettings + * + * @returns {object} metadata of MetricSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricSettings', + type: { + name: 'Composite', + className: 'MetricSettings', + modelProperties: { + timeGrain: { + required: false, + serializedName: 'timeGrain', + type: { + name: 'TimeSpan' + } + }, + category: { + required: false, + serializedName: 'category', + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + retentionPolicy: { + required: false, + serializedName: 'retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = MetricSettings; diff --git a/lib/services/monitor/lib/lib/models/metricTrigger.js b/lib/services/monitor/lib/lib/models/metricTrigger.js new file mode 100644 index 0000000000..09e76603e5 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricTrigger.js @@ -0,0 +1,125 @@ +/* + * 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 trigger that results in a scaling action. + * + */ +class MetricTrigger { + /** + * Create a MetricTrigger. + * @member {string} metricName the name of the metric that defines what the + * rule monitors. + * @member {string} metricResourceUri the resource identifier of the resource + * the rule monitors. + * @member {moment.duration} timeGrain the granularity of metrics the rule + * monitors. Must be one of the predefined values returned from metric + * definitions for the metric. Must be between 12 hours and 1 minute. + * @member {string} statistic the metric statistic type. How the metrics from + * multiple instances are combined. Possible values include: 'Average', + * 'Min', 'Max', 'Sum' + * @member {moment.duration} timeWindow the range of time in which instance + * data is collected. This value must be greater than the delay in metric + * collection, which can vary from resource-to-resource. Must be between 12 + * hours and 5 minutes. + * @member {string} timeAggregation time aggregation type. How the data that + * is collected should be combined over time. The default value is Average. + * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' + * @member {string} operator the operator that is used to compare the metric + * data and the threshold. Possible values include: 'Equals', 'NotEquals', + * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold of the metric that triggers the + * scale action. + */ + constructor() { + } + + /** + * Defines the metadata of MetricTrigger + * + * @returns {object} metadata of MetricTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricTrigger', + type: { + name: 'Composite', + className: 'MetricTrigger', + modelProperties: { + metricName: { + required: true, + serializedName: 'metricName', + type: { + name: 'String' + } + }, + metricResourceUri: { + required: true, + serializedName: 'metricResourceUri', + type: { + name: 'String' + } + }, + timeGrain: { + required: true, + serializedName: 'timeGrain', + type: { + name: 'TimeSpan' + } + }, + statistic: { + required: true, + serializedName: 'statistic', + type: { + name: 'Enum', + allowedValues: [ 'Average', 'Min', 'Max', 'Sum' ] + } + }, + timeWindow: { + required: true, + serializedName: 'timeWindow', + type: { + name: 'TimeSpan' + } + }, + timeAggregation: { + required: true, + serializedName: 'timeAggregation', + type: { + name: 'Enum', + allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Count' ] + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'Enum', + allowedValues: [ 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = MetricTrigger; diff --git a/lib/services/monitor/lib/lib/models/metricValue.js b/lib/services/monitor/lib/lib/models/metricValue.js new file mode 100644 index 0000000000..289f6ad9b0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricValue.js @@ -0,0 +1,95 @@ +/* + * 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 metric value. + * + */ +class MetricValue { + /** + * Create a MetricValue. + * @member {date} timeStamp the timestamp for the metric value in ISO 8601 + * format. + * @member {number} [average] the average value in the time range. + * @member {number} [minimum] the least value in the time range. + * @member {number} [maximum] the greatest value in the time range. + * @member {number} [total] the sum of all of the values in the time range. + * @member {number} [count] the number of samples in the time range. Can be + * used to determine the number of values that contributed to the average + * value. + */ + constructor() { + } + + /** + * Defines the metadata of MetricValue + * + * @returns {object} metadata of MetricValue + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricValue', + type: { + name: 'Composite', + className: 'MetricValue', + modelProperties: { + timeStamp: { + required: true, + serializedName: 'timeStamp', + type: { + name: 'DateTime' + } + }, + average: { + required: false, + serializedName: 'average', + type: { + name: 'Number' + } + }, + minimum: { + required: false, + serializedName: 'minimum', + type: { + name: 'Number' + } + }, + maximum: { + required: false, + serializedName: 'maximum', + type: { + name: 'Number' + } + }, + total: { + required: false, + serializedName: 'total', + type: { + name: 'Number' + } + }, + count: { + required: false, + serializedName: 'count', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = MetricValue; diff --git a/lib/services/monitor/lib/lib/models/operation.js b/lib/services/monitor/lib/lib/models/operation.js new file mode 100644 index 0000000000..83a27ddcc0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/operation.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Microsoft Insights API operation definition. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft.Insights + * @member {string} [display.resource] Resource on which the operation is + * performed: AlertRules, Autoscale, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/monitor/lib/lib/models/operationDisplay.js b/lib/services/monitor/lib/lib/models/operationDisplay.js new file mode 100644 index 0000000000..8e414a0a13 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/operationDisplay.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'; + +/** + * Display metadata associated with the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft.Insights + * @member {string} [resource] Resource on which the operation is performed: + * AlertRules, Autoscale, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/monitor/lib/lib/models/operationListResult.js b/lib/services/monitor/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..cad3161962 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/operationListResult.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Result of the request to list Microsoft.Insights operations. It contains a + * list of operations and a URL link to get the next set of results. + * + */ +class OperationListResult { + /** + * Create a OperationListResult. + * @member {array} [value] List of operations supported by the + * Microsoft.Insights provider. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/monitor/lib/lib/models/proxyOnlyResource.js b/lib/services/monitor/lib/lib/models/proxyOnlyResource.js new file mode 100644 index 0000000000..768abba9af --- /dev/null +++ b/lib/services/monitor/lib/lib/models/proxyOnlyResource.js @@ -0,0 +1,75 @@ +/* + * 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'); + +/** + * A proxy only azure resource object + * + * @extends models['BaseResource'] + */ +class ProxyOnlyResource extends models['BaseResource'] { + /** + * Create a ProxyOnlyResource. + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProxyOnlyResource + * + * @returns {object} metadata of ProxyOnlyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ProxyOnlyResource', + type: { + name: 'Composite', + className: 'ProxyOnlyResource', + 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' + } + } + } + } + }; + } +} + +module.exports = ProxyOnlyResource; diff --git a/lib/services/monitor/lib/lib/models/recurrence.js b/lib/services/monitor/lib/lib/models/recurrence.js new file mode 100644 index 0000000000..cb2dddd1d5 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/recurrence.js @@ -0,0 +1,114 @@ +/* + * 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 repeating times at which this profile begins. This element is not used + * if the FixedDate element is used. + * + */ +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 + * profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard + * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada + * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + * Atlantic Standard Time, Central Brazilian Standard Time, SA Western + * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + * South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [schedule.days] the collection of days that the profile + * takes effect on. Possible values are Sunday through Saturday. + * @member {array} [schedule.hours] A collection of hours that the profile + * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM + * times are not supported). + * @member {array} [schedule.minutes] A collection of minutes at which the + * profile takes effect at. + */ + constructor() { + } + + /** + * Defines the metadata of Recurrence + * + * @returns {object} metadata of Recurrence + * + */ + mapper() { + return { + required: false, + serializedName: 'Recurrence', + type: { + name: 'Composite', + className: 'Recurrence', + modelProperties: { + frequency: { + required: true, + serializedName: 'frequency', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ] + } + }, + schedule: { + required: true, + serializedName: 'schedule', + type: { + name: 'Composite', + className: 'RecurrentSchedule' + } + } + } + } + }; + } +} + +module.exports = Recurrence; diff --git a/lib/services/monitor/lib/lib/models/recurrentSchedule.js b/lib/services/monitor/lib/lib/models/recurrentSchedule.js new file mode 100644 index 0000000000..dec886f658 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/recurrentSchedule.js @@ -0,0 +1,138 @@ +/* + * 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 scheduling constraints for when the profile begins. + * + */ +class RecurrentSchedule { + /** + * Create a RecurrentSchedule. + * @member {string} timeZone the timezone for the hours of the profile. Some + * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian + * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), + * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time + * (Mexico), Mountain Standard Time, Central America Standard Time, Central + * Standard Time, Central Standard Time (Mexico), Canada Central Standard + * Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard + * Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard + * Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific + * SA Standard Time, Newfoundland Standard Time, E. South America Standard + * Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard + * Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard + * Time, W. Europe Standard Time, Central Europe Standard Time, Romance + * Standard Time, Central European Standard Time, W. Central Africa Standard + * Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, + * Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. + * Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} days the collection of days that the profile takes effect + * on. Possible values are Sunday through Saturday. + * @member {array} hours A collection of hours that the profile takes effect + * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not + * supported). + * @member {array} minutes A collection of minutes at which the profile takes + * effect at. + */ + constructor() { + } + + /** + * Defines the metadata of RecurrentSchedule + * + * @returns {object} metadata of RecurrentSchedule + * + */ + mapper() { + return { + required: false, + serializedName: 'RecurrentSchedule', + type: { + name: 'Composite', + className: 'RecurrentSchedule', + modelProperties: { + timeZone: { + required: true, + serializedName: 'timeZone', + type: { + name: 'String' + } + }, + days: { + required: true, + serializedName: 'days', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + hours: { + required: true, + serializedName: 'hours', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + minutes: { + required: true, + serializedName: 'minutes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = RecurrentSchedule; diff --git a/lib/services/monitor/lib/lib/models/resource.js b/lib/services/monitor/lib/lib/models/resource.js new file mode 100644 index 0000000000..429ae3a958 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * 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'); + +/** + * An azure resource object + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + * @member {string} location Resource location + * @member {object} [tags] Resource tags + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + 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' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/monitor/lib/lib/models/response.js b/lib/services/monitor/lib/lib/models/response.js new file mode 100644 index 0000000000..20e0c9cbb3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/response.js @@ -0,0 +1,113 @@ +/* + * 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 response to a metrics query. + * + */ +class Response { + /** + * Create a Response. + * @member {number} [cost] The integer value representing the cost of the + * query, for data case. + * @member {string} timespan The timespan for which the data was retrieved. + * Its value consists of two datatimes concatenated, separated by '/'. This + * may be adjusted in the future and returned back from what was originally + * requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if + * a metadata request was made. + * @member {string} [namespace] The namespace of the metrics been queried + * @member {string} [resourceregion] The region of the resource been queried + * for metrics. + * @member {array} value the value of the collection. + */ + constructor() { + } + + /** + * Defines the metadata of Response + * + * @returns {object} metadata of Response + * + */ + mapper() { + return { + required: false, + serializedName: 'Response', + type: { + name: 'Composite', + className: 'Response', + modelProperties: { + cost: { + required: false, + serializedName: 'cost', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + }, + timespan: { + required: true, + serializedName: 'timespan', + type: { + name: 'String' + } + }, + interval: { + required: false, + serializedName: 'interval', + type: { + name: 'TimeSpan' + } + }, + namespace: { + required: false, + serializedName: 'namespace', + type: { + name: 'String' + } + }, + resourceregion: { + required: false, + serializedName: 'resourceregion', + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricElementType', + type: { + name: 'Composite', + className: 'Metric' + } + } + } + } + } + } + }; + } +} + +module.exports = Response; diff --git a/lib/services/monitor/lib/lib/models/retentionPolicy.js b/lib/services/monitor/lib/lib/models/retentionPolicy.js new file mode 100644 index 0000000000..1ae39bed86 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/retentionPolicy.js @@ -0,0 +1,65 @@ +/* + * 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 retention policy for the log. + * + */ +class RetentionPolicy { + /** + * Create a RetentionPolicy. + * @member {boolean} enabled a value indicating whether the retention policy + * is enabled. + * @member {number} days the number of days for the retention in days. A + * value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of RetentionPolicy + * + * @returns {object} metadata of RetentionPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'RetentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy', + modelProperties: { + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + days: { + required: true, + serializedName: 'days', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = RetentionPolicy; diff --git a/lib/services/monitor/lib/lib/models/ruleAction.js b/lib/services/monitor/lib/lib/models/ruleAction.js new file mode 100644 index 0000000000..8cc7f75b03 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleAction.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'; + +/** + * The action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + */ +class RuleAction { + /** + * Create a RuleAction. + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of RuleAction + * + * @returns {object} metadata of RuleAction + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleAction; diff --git a/lib/services/monitor/lib/lib/models/ruleCondition.js b/lib/services/monitor/lib/lib/models/ruleCondition.js new file mode 100644 index 0000000000..5b43f85397 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleCondition.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'; + +const models = require('./index'); + +/** + * The condition that results in the alert rule being activated. + * + */ +class RuleCondition { + /** + * Create a RuleCondition. + * @member {object} [dataSource] the resource from which the rule collects + * its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [dataSource.resourceUri] the resource identifier of the + * resource the rule monitors. **NOTE**: this property cannot be updated for + * an existing rule. + * @member {string} [dataSource.odatatype] Polymorphic Discriminator + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of RuleCondition + * + * @returns {object} metadata of RuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'RuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleCondition; diff --git a/lib/services/monitor/lib/lib/models/ruleDataSource.js b/lib/services/monitor/lib/lib/models/ruleDataSource.js new file mode 100644 index 0000000000..f106206ee3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleDataSource.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The resource from which the rule collects its data. + * + */ +class RuleDataSource { + /** + * Create a RuleDataSource. + * @member {string} [resourceUri] the resource identifier of the resource the + * rule monitors. **NOTE**: this property cannot be updated for an existing + * rule. + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of RuleDataSource + * + * @returns {object} metadata of RuleDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleDataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource', + modelProperties: { + resourceUri: { + required: false, + serializedName: 'resourceUri', + type: { + name: 'String' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleEmailAction.js b/lib/services/monitor/lib/lib/models/ruleEmailAction.js new file mode 100644 index 0000000000..7a5a3b4e66 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleEmailAction.js @@ -0,0 +1,88 @@ +/* + * 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'); + +/** + * Specifies the action to send email when the rule condition is evaluated. The + * discriminator is always RuleEmailAction in this case. + * + * @extends models['RuleAction'] + */ +class RuleEmailAction extends models['RuleAction'] { + /** + * Create a RuleEmailAction. + * @member {boolean} [sendToServiceOwners] Whether the administrators + * (service and co-administrators) of the service should be notified when the + * alert is activated. + * @member {array} [customEmails] the list of administrator's custom email + * addresses to notify of the activation of the alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleEmailAction + * + * @returns {object} metadata of RuleEmailAction + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleEmailAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + sendToServiceOwners: { + required: false, + serializedName: 'sendToServiceOwners', + type: { + name: 'Boolean' + } + }, + customEmails: { + required: false, + serializedName: 'customEmails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = RuleEmailAction; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js new file mode 100644 index 0000000000..a8a5de752c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js @@ -0,0 +1,52 @@ +/* + * 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 claims for a rule management event data source. + * + */ +class RuleManagementEventClaimsDataSource { + /** + * Create a RuleManagementEventClaimsDataSource. + * @member {string} [emailAddress] the email address. + */ + constructor() { + } + + /** + * Defines the metadata of RuleManagementEventClaimsDataSource + * + * @returns {object} metadata of RuleManagementEventClaimsDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleManagementEventClaimsDataSource', + type: { + name: 'Composite', + className: 'RuleManagementEventClaimsDataSource', + modelProperties: { + emailAddress: { + required: false, + serializedName: 'emailAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleManagementEventClaimsDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js new file mode 100644 index 0000000000..b981085f6d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js @@ -0,0 +1,145 @@ +/* + * 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'); + +/** + * A rule management event data source. The discriminator fields is always + * RuleManagementEventDataSource in this case. + * + * @extends models['RuleDataSource'] + */ +class RuleManagementEventDataSource extends models['RuleDataSource'] { + /** + * Create a RuleManagementEventDataSource. + * @member {string} [eventName] the event name. + * @member {string} [eventSource] the event source. + * @member {string} [level] the level. + * @member {string} [operationName] The name of the operation that should be + * checked for. If no name is provided, any operation will match. + * @member {string} [resourceGroupName] the resource group name. + * @member {string} [resourceProviderName] the resource provider name. + * @member {string} [status] The status of the operation that should be + * checked for. If no status is provided, any status will match. + * @member {string} [subStatus] the substatus. + * @member {object} [claims] the claims. + * @member {string} [claims.emailAddress] the email address. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleManagementEventDataSource + * + * @returns {object} metadata of RuleManagementEventDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleManagementEventDataSource', + modelProperties: { + resourceUri: { + required: false, + serializedName: 'resourceUri', + type: { + name: 'String' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + eventName: { + required: false, + serializedName: 'eventName', + type: { + name: 'String' + } + }, + eventSource: { + required: false, + serializedName: 'eventSource', + type: { + name: 'String' + } + }, + level: { + required: false, + serializedName: 'level', + type: { + name: 'String' + } + }, + operationName: { + required: false, + serializedName: 'operationName', + type: { + name: 'String' + } + }, + resourceGroupName: { + required: false, + serializedName: 'resourceGroupName', + type: { + name: 'String' + } + }, + resourceProviderName: { + required: false, + serializedName: 'resourceProviderName', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + subStatus: { + required: false, + serializedName: 'subStatus', + type: { + name: 'String' + } + }, + claims: { + required: false, + serializedName: 'claims', + type: { + name: 'Composite', + className: 'RuleManagementEventClaimsDataSource' + } + } + } + } + }; + } +} + +module.exports = RuleManagementEventDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js b/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js new file mode 100644 index 0000000000..abf2f6aae1 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js @@ -0,0 +1,78 @@ +/* + * 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'); + +/** + * A rule metric data source. The discriminator value is always + * RuleMetricDataSource in this case. + * + * @extends models['RuleDataSource'] + */ +class RuleMetricDataSource extends models['RuleDataSource'] { + /** + * Create a RuleMetricDataSource. + * @member {string} [metricName] the name of the metric that defines what the + * rule monitors. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleMetricDataSource + * + * @returns {object} metadata of RuleMetricDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleMetricDataSource', + modelProperties: { + resourceUri: { + required: false, + serializedName: 'resourceUri', + type: { + name: 'String' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + metricName: { + required: false, + serializedName: 'metricName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleMetricDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleWebhookAction.js b/lib/services/monitor/lib/lib/models/ruleWebhookAction.js new file mode 100644 index 0000000000..58cf335564 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleWebhookAction.js @@ -0,0 +1,88 @@ +/* + * 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'); + +/** + * Specifies the action to post to service when the rule condition is + * evaluated. The discriminator is always RuleWebhookAction in this case. + * + * @extends models['RuleAction'] + */ +class RuleWebhookAction extends models['RuleAction'] { + /** + * Create a RuleWebhookAction. + * @member {string} [serviceUri] the service uri to Post the notification + * when the alert activates or resolves. + * @member {object} [properties] the dictionary of custom properties to + * include with the post operation. These data are appended to the webhook + * payload. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleWebhookAction + * + * @returns {object} metadata of RuleWebhookAction + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleWebhookAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + serviceUri: { + required: false, + serializedName: 'serviceUri', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = RuleWebhookAction; diff --git a/lib/services/monitor/lib/lib/models/scaleAction.js b/lib/services/monitor/lib/lib/models/scaleAction.js new file mode 100644 index 0000000000..e07a8a5d27 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/scaleAction.js @@ -0,0 +1,87 @@ +/* + * 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 parameters for the scaling action. + * + */ +class ScaleAction { + /** + * Create a ScaleAction. + * @member {string} direction the scale direction. Whether the scaling action + * increases or decreases the number of instances. Possible values include: + * 'None', 'Increase', 'Decrease' + * @member {string} type the type of action that should occur when the scale + * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', + * 'ExactCount' + * @member {string} [value] the number of instances that are involved in the + * scaling action. This value must be 1 or greater. The default value is 1. + * Default value: '1' . + * @member {moment.duration} cooldown the amount of time to wait since the + * last scaling action before this action occurs. It must be between 1 week + * and 1 minute in ISO 8601 format. + */ + constructor() { + } + + /** + * Defines the metadata of ScaleAction + * + * @returns {object} metadata of ScaleAction + * + */ + mapper() { + return { + required: false, + serializedName: 'ScaleAction', + type: { + name: 'Composite', + className: 'ScaleAction', + modelProperties: { + direction: { + required: true, + serializedName: 'direction', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Increase', 'Decrease' ] + } + }, + type: { + required: true, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'ChangeCount', 'PercentChangeCount', 'ExactCount' ] + } + }, + value: { + required: false, + serializedName: 'value', + defaultValue: '1', + type: { + name: 'String' + } + }, + cooldown: { + required: true, + serializedName: 'cooldown', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = ScaleAction; diff --git a/lib/services/monitor/lib/lib/models/scaleCapacity.js b/lib/services/monitor/lib/lib/models/scaleCapacity.js new file mode 100644 index 0000000000..841ec3393c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/scaleCapacity.js @@ -0,0 +1,72 @@ +/* + * 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 number of instances that can be used during this profile. + * + */ +class ScaleCapacity { + /** + * Create a ScaleCapacity. + * @member {string} minimum the minimum number of instances for the resource. + * @member {string} maximum the maximum number of instances for the resource. + * The actual maximum number of instances is limited by the cores that are + * available in the subscription. + * @member {string} default the number of instances that will be set if + * metrics are not available for evaluation. The default is only used if the + * current instance count is lower than the default. + */ + constructor() { + } + + /** + * Defines the metadata of ScaleCapacity + * + * @returns {object} metadata of ScaleCapacity + * + */ + mapper() { + return { + required: false, + serializedName: 'ScaleCapacity', + type: { + name: 'Composite', + className: 'ScaleCapacity', + modelProperties: { + minimum: { + required: true, + serializedName: 'minimum', + type: { + name: 'String' + } + }, + maximum: { + required: true, + serializedName: 'maximum', + type: { + name: 'String' + } + }, + default: { + required: true, + serializedName: 'default', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ScaleCapacity; diff --git a/lib/services/monitor/lib/lib/models/scaleRule.js b/lib/services/monitor/lib/lib/models/scaleRule.js new file mode 100644 index 0000000000..0836d498c2 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/scaleRule.js @@ -0,0 +1,102 @@ +/* + * 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'); + +/** + * A rule that provide the triggers and parameters for the scaling action. + * + */ +class ScaleRule { + /** + * Create a ScaleRule. + * @member {object} metricTrigger the trigger that results in a scaling + * action. + * @member {string} [metricTrigger.metricName] the name of the metric that + * defines what the rule monitors. + * @member {string} [metricTrigger.metricResourceUri] the resource identifier + * of the resource the rule monitors. + * @member {moment.duration} [metricTrigger.timeGrain] the granularity of + * metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [metricTrigger.statistic] the metric statistic type. How + * the metrics from multiple instances are combined. Possible values include: + * 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [metricTrigger.timeWindow] the range of time in + * which instance data is collected. This value must be greater than the + * delay in metric collection, which can vary from resource-to-resource. Must + * be between 12 hours and 5 minutes. + * @member {string} [metricTrigger.timeAggregation] time aggregation type. + * How the data that is collected should be combined over time. The default + * value is Average. Possible values include: 'Average', 'Minimum', + * 'Maximum', 'Total', 'Count' + * @member {string} [metricTrigger.operator] the operator that is used to + * compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [metricTrigger.threshold] the threshold of the metric + * that triggers the scale action. + * @member {object} scaleAction the parameters for the scaling action. + * @member {string} [scaleAction.direction] the scale direction. Whether the + * scaling action increases or decreases the number of instances. Possible + * values include: 'None', 'Increase', 'Decrease' + * @member {string} [scaleAction.type] the type of action that should occur + * when the scale rule fires. Possible values include: 'ChangeCount', + * 'PercentChangeCount', 'ExactCount' + * @member {string} [scaleAction.value] the number of instances that are + * involved in the scaling action. This value must be 1 or greater. The + * default value is 1. + * @member {moment.duration} [scaleAction.cooldown] the amount of time to + * wait since the last scaling action before this action occurs. It must be + * between 1 week and 1 minute in ISO 8601 format. + */ + constructor() { + } + + /** + * Defines the metadata of ScaleRule + * + * @returns {object} metadata of ScaleRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ScaleRule', + type: { + name: 'Composite', + className: 'ScaleRule', + modelProperties: { + metricTrigger: { + required: true, + serializedName: 'metricTrigger', + type: { + name: 'Composite', + className: 'MetricTrigger' + } + }, + scaleAction: { + required: true, + serializedName: 'scaleAction', + type: { + name: 'Composite', + className: 'ScaleAction' + } + } + } + } + }; + } +} + +module.exports = ScaleRule; diff --git a/lib/services/monitor/lib/lib/models/senderAuthorization.js b/lib/services/monitor/lib/lib/models/senderAuthorization.js new file mode 100644 index 0000000000..db357336e2 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/senderAuthorization.js @@ -0,0 +1,72 @@ +/* + * 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 authorization used by the user who has performed the operation that led + * to this event. This captures the RBAC properties of the event. These usually + * include the 'action', 'role' and the 'scope' + * + */ +class SenderAuthorization { + /** + * Create a SenderAuthorization. + * @member {string} [action] the permissible actions. For instance: + * microsoft.support/supporttickets/write + * @member {string} [role] the role of the user. For instance: Subscription + * Admin + * @member {string} [scope] the scope. + */ + constructor() { + } + + /** + * Defines the metadata of SenderAuthorization + * + * @returns {object} metadata of SenderAuthorization + * + */ + mapper() { + return { + required: false, + serializedName: 'SenderAuthorization', + type: { + name: 'Composite', + className: 'SenderAuthorization', + modelProperties: { + action: { + required: false, + serializedName: 'action', + type: { + name: 'String' + } + }, + role: { + required: false, + serializedName: 'role', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'scope', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SenderAuthorization; diff --git a/lib/services/monitor/lib/lib/models/smsReceiver.js b/lib/services/monitor/lib/lib/models/smsReceiver.js new file mode 100644 index 0000000000..9579690c9e --- /dev/null +++ b/lib/services/monitor/lib/lib/models/smsReceiver.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'; + +/** + * An SMS receiver. + * + */ +class SmsReceiver { + /** + * Create a SmsReceiver. + * @member {string} name The name of the SMS receiver. Names must be unique + * across all receivers within an action group. + * @member {string} countryCode The country code of the SMS receiver. + * @member {string} phoneNumber The phone number of the SMS receiver. + * @member {string} [status] The status of the receiver. Possible values + * include: 'NotSpecified', 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of SmsReceiver + * + * @returns {object} metadata of SmsReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'SmsReceiver', + type: { + name: 'Composite', + className: 'SmsReceiver', + 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' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] + } + } + } + } + }; + } +} + +module.exports = SmsReceiver; diff --git a/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js new file mode 100644 index 0000000000..899822bb45 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js @@ -0,0 +1,115 @@ +/* + * 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'); + +/** + * A rule condition based on a metric crossing a threshold. + * + * @extends models['RuleCondition'] + */ +class ThresholdRuleCondition extends models['RuleCondition'] { + /** + * Create a ThresholdRuleCondition. + * @member {string} operator the operator used to compare the data and the + * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', + * 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {string} [timeAggregation] the time aggregation operator. How the + * data that are collected should be combined over time. The default value is + * the PrimaryAggregationType of the Metric. Possible values include: + * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ThresholdRuleCondition + * + * @returns {object} metadata of ThresholdRuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'ThresholdRuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'Enum', + allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + windowSize: { + required: false, + serializedName: 'windowSize', + type: { + name: 'TimeSpan' + } + }, + timeAggregation: { + required: false, + serializedName: 'timeAggregation', + type: { + name: 'Enum', + allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Last' ] + } + } + } + } + }; + } +} + +module.exports = ThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesElement.js b/lib/services/monitor/lib/lib/models/timeSeriesElement.js new file mode 100644 index 0000000000..576f5a51ab --- /dev/null +++ b/lib/services/monitor/lib/lib/models/timeSeriesElement.js @@ -0,0 +1,81 @@ +/* + * 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'); + +/** + * A time series result type. The discriminator value is always TimeSeries in + * this case. + * + */ +class TimeSeriesElement { + /** + * Create a TimeSeriesElement. + * @member {array} [metadatavalues] the metadata values returned if $filter + * was specified in the call. + * @member {array} [data] An array of data points representing the metric + * values. This is only returned if a result type of data is specified. + */ + constructor() { + } + + /** + * Defines the metadata of TimeSeriesElement + * + * @returns {object} metadata of TimeSeriesElement + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeSeriesElement', + type: { + name: 'Composite', + className: 'TimeSeriesElement', + modelProperties: { + metadatavalues: { + required: false, + serializedName: 'metadatavalues', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetadataValueElementType', + type: { + name: 'Composite', + className: 'MetadataValue' + } + } + } + }, + data: { + required: false, + serializedName: 'data', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricValueElementType', + type: { + name: 'Composite', + className: 'MetricValue' + } + } + } + } + } + } + }; + } +} + +module.exports = TimeSeriesElement; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesInformation.js b/lib/services/monitor/lib/lib/models/timeSeriesInformation.js new file mode 100644 index 0000000000..f4d8ac5464 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/timeSeriesInformation.js @@ -0,0 +1,90 @@ +/* + * 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 time series info needed for calculating the baseline. + * + */ +class TimeSeriesInformation { + /** + * Create a TimeSeriesInformation. + * @member {array} sensitivities the list of sensitivities for calculating + * the baseline. + * @member {array} values The metric values to calculate the baseline. + * @member {array} [timestamps] the array of timestamps of the baselines. + */ + constructor() { + } + + /** + * Defines the metadata of TimeSeriesInformation + * + * @returns {object} metadata of TimeSeriesInformation + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeSeriesInformation', + type: { + name: 'Composite', + className: 'TimeSeriesInformation', + modelProperties: { + sensitivities: { + required: true, + serializedName: 'sensitivities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + values: { + required: true, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + timestamps: { + required: false, + serializedName: 'timestamps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DateElementType', + type: { + name: 'DateTime' + } + } + } + } + } + } + }; + } +} + +module.exports = TimeSeriesInformation; diff --git a/lib/services/monitor/lib/lib/models/timeWindow.js b/lib/services/monitor/lib/lib/models/timeWindow.js new file mode 100644 index 0000000000..c072fd288a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/timeWindow.js @@ -0,0 +1,105 @@ +/* + * 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 specific date-time for the profile. + * + */ +class TimeWindow { + /** + * Create a TimeWindow. + * @member {string} [timeZone] the timezone of the start and end times for + * the profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard + * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada + * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + * Atlantic Standard Time, Central Brazilian Standard Time, SA Western + * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + * South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {date} start the start time for the profile in ISO 8601 format. + * @member {date} end the end time for the profile in ISO 8601 format. + */ + constructor() { + } + + /** + * Defines the metadata of TimeWindow + * + * @returns {object} metadata of TimeWindow + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeWindow', + type: { + name: 'Composite', + className: 'TimeWindow', + modelProperties: { + timeZone: { + required: false, + serializedName: 'timeZone', + type: { + name: 'String' + } + }, + start: { + required: true, + serializedName: 'start', + type: { + name: 'DateTime' + } + }, + end: { + required: true, + serializedName: 'end', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = TimeWindow; diff --git a/lib/services/monitor/lib/lib/models/voiceReceiver.js b/lib/services/monitor/lib/lib/models/voiceReceiver.js new file mode 100644 index 0000000000..ac1ac1025d --- /dev/null +++ b/lib/services/monitor/lib/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/monitor/lib/lib/models/webhookNotification.js b/lib/services/monitor/lib/lib/models/webhookNotification.js new file mode 100644 index 0000000000..bc05f4b1a1 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/webhookNotification.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'; + +/** + * Webhook notification of an autoscale event. + * + */ +class WebhookNotification { + /** + * Create a WebhookNotification. + * @member {string} [serviceUri] the service address to receive the + * notification. + * @member {object} [properties] a property bag of settings. This value can + * be empty. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookNotification + * + * @returns {object} metadata of WebhookNotification + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookNotification', + type: { + name: 'Composite', + className: 'WebhookNotification', + modelProperties: { + serviceUri: { + required: false, + serializedName: 'serviceUri', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = WebhookNotification; diff --git a/lib/services/monitor/lib/lib/models/webhookReceiver.js b/lib/services/monitor/lib/lib/models/webhookReceiver.js new file mode 100644 index 0000000000..bfaf7cd202 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/webhookReceiver.js @@ -0,0 +1,61 @@ +/* + * 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 webhook receiver. + * + */ +class WebhookReceiver { + /** + * Create a WebhookReceiver. + * @member {string} name The name of the webhook receiver. Names must be + * unique across all receivers within an action group. + * @member {string} serviceUri The URI where webhooks should be sent. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookReceiver + * + * @returns {object} metadata of WebhookReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookReceiver', + type: { + name: 'Composite', + className: 'WebhookReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + serviceUri: { + required: true, + serializedName: 'serviceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebhookReceiver; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.d.ts b/lib/services/monitor/lib/lib/monitorManagementClient.d.ts new file mode 100644 index 0000000000..9c64e133dc --- /dev/null +++ b/lib/services/monitor/lib/lib/monitorManagementClient.d.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class MonitorManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the MonitorManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The Azure subscription Id. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @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. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + autoscaleSettings: operations.AutoscaleSettings; + operations: operations.Operations; + alertRuleIncidents: operations.AlertRuleIncidents; + alertRules: operations.AlertRules; + logProfiles: operations.LogProfiles; + diagnosticSettingsOperations: operations.DiagnosticSettingsOperations; + diagnosticSettingsCategoryOperations: operations.DiagnosticSettingsCategoryOperations; + actionGroups: operations.ActionGroups; + activityLogAlerts: operations.ActivityLogAlerts; + activityLogs: operations.ActivityLogs; + eventCategories: operations.EventCategories; + tenantActivityLogs: operations.TenantActivityLogs; + metricDefinitions: operations.MetricDefinitions; + metrics: operations.Metrics; + metricBaseline: operations.MetricBaseline; + metricAlerts: operations.MetricAlerts; + metricAlertsStatus: operations.MetricAlertsStatus; +} + +export { MonitorManagementClient, models as MonitorManagementModels }; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.js b/lib/services/monitor/lib/lib/monitorManagementClient.js new file mode 100644 index 0000000000..356cd3c461 --- /dev/null +++ b/lib/services/monitor/lib/lib/monitorManagementClient.js @@ -0,0 +1,100 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a MonitorManagementClient. */ +class MonitorManagementClient extends ServiceClient { + /** + * Create a MonitorManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The Azure subscription Id. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @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. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.autoscaleSettings = new operations.AutoscaleSettings(this); + this.operations = new operations.Operations(this); + this.alertRuleIncidents = new operations.AlertRuleIncidents(this); + this.alertRules = new operations.AlertRules(this); + this.logProfiles = new operations.LogProfiles(this); + this.diagnosticSettingsOperations = new operations.DiagnosticSettingsOperations(this); + this.diagnosticSettingsCategoryOperations = new operations.DiagnosticSettingsCategoryOperations(this); + this.actionGroups = new operations.ActionGroups(this); + this.activityLogAlerts = new operations.ActivityLogAlerts(this); + this.activityLogs = new operations.ActivityLogs(this); + this.eventCategories = new operations.EventCategories(this); + this.tenantActivityLogs = new operations.TenantActivityLogs(this); + this.metricDefinitions = new operations.MetricDefinitions(this); + this.metrics = new operations.Metrics(this); + this.metricBaseline = new operations.MetricBaseline(this); + this.metricAlerts = new operations.MetricAlerts(this); + this.metricAlertsStatus = new operations.MetricAlertsStatus(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = MonitorManagementClient; +module.exports['default'] = MonitorManagementClient; +module.exports.MonitorManagementClient = MonitorManagementClient; +module.exports.MonitorManagementModels = models; diff --git a/lib/services/monitor/lib/lib/operations/actionGroups.js b/lib/services/monitor/lib/lib/operations/actionGroups.js new file mode 100644 index 0000000000..5c41c3e997 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/actionGroups.js @@ -0,0 +1,1810 @@ +/* + * 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; + +/** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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 ActionGroupResource} 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, actionGroupName, actionGroup, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); + } + if (actionGroup === null || actionGroup === undefined) { + throw new Error('actionGroup cannot be null or undefined.'); + } + 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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 = '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 (actionGroup !== null && actionGroup !== undefined) { + let requestModelMapper = new client.models['ActionGroupResource']().mapper(); + requestModel = client.serialize(requestModelMapper, actionGroup, 'actionGroup'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(actionGroup, 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['ActionGroupResource']().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['ActionGroupResource']().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); + }); +} + +/** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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 ActionGroupResource} 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, actionGroupName, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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['ActionGroupResource']().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); + }); +} + +/** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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); + }); +} + +/** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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-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 (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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); + } + if (actionGroupPatch === null || actionGroupPatch === undefined) { + throw new Error('actionGroupPatch 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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 (actionGroupPatch !== null && actionGroupPatch !== undefined) { + let requestModelMapper = new client.models['ActionGroupPatchBody']().mapper(); + requestModel = client.serialize(requestModelMapper, actionGroupPatch, 'actionGroupPatch'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(actionGroupPatch, 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['ActionGroupResource']().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); + }); +} + +/** + * Get a list of all action groups in 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 ActionGroupList} 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 _listBySubscriptionId(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-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/actionGroups'; + 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['ActionGroupList']().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); + }); +} + +/** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 ActionGroupList} 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 apiVersion = '2018-03-01'; + // 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 (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/actionGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ActionGroupList']().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); + }); +} + +/** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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 _enableReceiver(resourceGroupName, actionGroupName, receiverName, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName 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 (receiverName === null || receiverName === undefined || typeof receiverName.valueOf() !== 'string') { + throw new Error('receiverName 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); + } + let enableRequest; + if (receiverName !== null && receiverName !== undefined) { + enableRequest = new client.models['EnableRequest'](); + enableRequest.receiverName = receiverName; + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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 = 'POST'; + 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 (enableRequest !== null && enableRequest !== undefined) { + let requestModelMapper = new client.models['EnableRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, enableRequest, 'enableRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(enableRequest, 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 !== 409) { + 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); + }); +} + +/** Class representing a ActionGroups. */ +class ActionGroups { + /** + * Create a ActionGroups. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listBySubscriptionId = _listBySubscriptionId; + this._listByResourceGroup = _listByResourceGroup; + this._enableReceiver = _enableReceiver; + } + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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, actionGroupName, actionGroup, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroup, 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, actionGroupName, actionGroup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, optionalCallback); + } + } + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, actionGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, actionGroupName, options, optionalCallback); + } + } + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, actionGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, actionGroupName, options, optionalCallback); + } + } + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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, actionGroupName, actionGroupPatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, optionalCallback); + } + } + + /** + * Get a list of all action groups in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionId(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a list of all action groups in 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 {ActionGroupList} - 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 ActionGroupList} 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. + */ + listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionId(options, optionalCallback); + } + } + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActionGroupList} - 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 ActionGroupList} 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); + } + } + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiverWithHttpOperationResponse(resourceGroupName, actionGroupName, receiverName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiver(resourceGroupName, actionGroupName, receiverName, 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._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, optionalCallback); + } + } + +} + +module.exports = ActionGroups; diff --git a/lib/services/monitor/lib/lib/operations/activityLogAlerts.js b/lib/services/monitor/lib/lib/operations/activityLogAlerts.js new file mode 100644 index 0000000000..bc6417b698 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/activityLogAlerts.js @@ -0,0 +1,1543 @@ +/* + * 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; + +/** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); + } + if (activityLogAlert === null || activityLogAlert === undefined) { + throw new Error('activityLogAlert 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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 (activityLogAlert !== null && activityLogAlert !== undefined) { + let requestModelMapper = new client.models['ActivityLogAlertResource']().mapper(); + requestModel = client.serialize(requestModelMapper, activityLogAlert, 'activityLogAlert'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(activityLogAlert, 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['ActivityLogAlertResource']().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['ActivityLogAlertResource']().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); + }); +} + +/** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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 ActivityLogAlertResource} 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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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['ActivityLogAlertResource']().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); + }); +} + +/** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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); + }); +} + +/** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); + } + if (activityLogAlertPatch === null || activityLogAlertPatch === undefined) { + throw new Error('activityLogAlertPatch 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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 (activityLogAlertPatch !== null && activityLogAlertPatch !== undefined) { + let requestModelMapper = new client.models['ActivityLogAlertPatchBody']().mapper(); + requestModel = client.serialize(requestModelMapper, activityLogAlertPatch, 'activityLogAlertPatch'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(activityLogAlertPatch, 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['ActivityLogAlertResource']().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); + }); +} + +/** + * Get a list of all activity log alerts in 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 ActivityLogAlertList} 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 _listBySubscriptionId(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 = '2017-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/activityLogAlerts'; + 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['ActivityLogAlertList']().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); + }); +} + +/** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 ActivityLogAlertList} 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 apiVersion = '2017-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 (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 (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/activityLogAlerts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ActivityLogAlertList']().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 ActivityLogAlerts. */ +class ActivityLogAlerts { + /** + * Create a ActivityLogAlerts. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listBySubscriptionId = _listBySubscriptionId; + this._listByResourceGroup = _listByResourceGroup; + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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, activityLogAlertName, activityLogAlert, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, optionalCallback); + } + } + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, activityLogAlertName, options, optionalCallback); + } + } + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, activityLogAlertName, options, optionalCallback); + } + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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, activityLogAlertName, activityLogAlertPatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, optionalCallback); + } + } + + /** + * Get a list of all activity log alerts in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionId(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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. + */ + listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionId(options, optionalCallback); + } + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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 = ActivityLogAlerts; diff --git a/lib/services/monitor/lib/lib/operations/activityLogs.js b/lib/services/monitor/lib/lib/operations/activityLogs.js new file mode 100644 index 0000000000..7128d017ab --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/activityLogs.js @@ -0,0 +1,545 @@ +/* + * 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; + +/** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; + let apiVersion = '2015-04-01'; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { + throw new Error('select 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/eventtypes/management/values'; + 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 (select !== null && select !== undefined) { + queryParameters.push('$select=' + encodeURIComponent(select)); + } + 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['EventDataCollection']().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); + }); +} + +/** + * Provides the list of records from the activity logs. + * + * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 ActivityLogs. */ +class ActivityLogs { + /** + * Create a ActivityLogs. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Provides the list of records from the activity logs. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ActivityLogs; diff --git a/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js b/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js new file mode 100644 index 0000000000..fac095135e --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js @@ -0,0 +1,500 @@ +/* + * 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; + +/** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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 Incident} 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, incidentName, 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 (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 (incidentName === null || incidentName === undefined || typeof incidentName.valueOf() !== 'string') { + throw new Error('incidentName 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/alertrules/{ruleName}/incidents/{incidentName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{incidentName}', encodeURIComponent(incidentName)); + 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['Incident']().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); + }); +} + +/** + * Gets a list of incidents associated to an alert 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 IncidentListResult} 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 _listByAlertRule(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 = '2016-03-01'; + // 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/alertrules/{ruleName}/incidents'; + 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) { + 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['IncidentListResult']().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 AlertRuleIncidents. */ +class AlertRuleIncidents { + /** + * Create a AlertRuleIncidents. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._listByAlertRule = _listByAlertRule; + } + + /** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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, incidentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, ruleName, incidentName, 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 incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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 {Incident} - 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 Incident} 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, incidentName, 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, incidentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, ruleName, incidentName, options, optionalCallback); + } + } + + /** + * Gets a list of incidents associated to an alert 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. + */ + listByAlertRuleWithHttpOperationResponse(resourceGroupName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAlertRule(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 a list of incidents associated to an alert 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 {IncidentListResult} - 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 IncidentListResult} 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. + */ + listByAlertRule(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._listByAlertRule(resourceGroupName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAlertRule(resourceGroupName, ruleName, options, optionalCallback); + } + } + +} + +module.exports = AlertRuleIncidents; diff --git a/lib/services/monitor/lib/lib/operations/alertRules.js b/lib/services/monitor/lib/lib/operations/alertRules.js new file mode 100644 index 0000000000..3676f74c97 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/alertRules.js @@ -0,0 +1,1423 @@ +/* + * 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 alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 AlertRuleResource} 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 = '2016-03-01'; + // 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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/alertrules/{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 = '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['AlertRuleResource']().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['AlertRuleResource']().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['AlertRuleResource']().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); + }); +} + +/** + * Deletes an alert 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 = '2016-03-01'; + // 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/alertrules/{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) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets an alert 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 AlertRuleResource} 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 = '2016-03-01'; + // 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/alertrules/{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) { + 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['AlertRuleResource']().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); + }); +} + +/** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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 AlertRuleResource} 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, alertRulesResource, 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 (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 (alertRulesResource === null || alertRulesResource === undefined) { + throw new Error('alertRulesResource 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/alertrules/{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 (alertRulesResource !== null && alertRulesResource !== undefined) { + let requestModelMapper = new client.models['AlertRuleResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, alertRulesResource, 'alertRulesResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(alertRulesResource, 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['AlertRuleResource']().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['AlertRuleResource']().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); + }); +} + +/** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 _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 apiVersion = '2016-03-01'; + // 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 (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/alertrules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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 { + /** + * Create a AlertRules. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listByResourceGroup = _listByResourceGroup; + } + + /** + * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {AlertRuleResource} - 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 AlertRuleResource} 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); + } + } + + /** + * Deletes an alert 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 an alert 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); + } + } + + /** + * Gets an alert 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 alert 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 {AlertRuleResource} - 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 AlertRuleResource} 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); + } + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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, alertRulesResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, ruleName, alertRulesResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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 {AlertRuleResource} - 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 AlertRuleResource} 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, alertRulesResource, 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, alertRulesResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, ruleName, alertRulesResource, options, optionalCallback); + } + } + + /** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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 alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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 = AlertRules; diff --git a/lib/services/monitor/lib/lib/operations/autoscaleSettings.js b/lib/services/monitor/lib/lib/operations/autoscaleSettings.js new file mode 100644 index 0000000000..a65507da16 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/autoscaleSettings.js @@ -0,0 +1,1561 @@ +/* + * 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; + +/** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 _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 apiVersion = '2015-04-01'; + // 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 (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/autoscalesettings'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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); + }); +} + +/** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 = '2015-04-01'; + // 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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName 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.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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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 = '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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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); + }); +} + +/** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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); + }); +} + +/** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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['AutoscaleSettingResource']().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); + }); +} + +/** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName cannot be null or undefined and it must be of type string.'); + } + if (autoscaleSettingResource === null || autoscaleSettingResource === undefined) { + throw new Error('autoscaleSettingResource 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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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 (autoscaleSettingResource !== null && autoscaleSettingResource !== undefined) { + let requestModelMapper = new client.models['AutoscaleSettingResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, autoscaleSettingResource, 'autoscaleSettingResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(autoscaleSettingResource, 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['AutoscaleSettingResource']().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 + * + * @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 _listByResourceGroupNext(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 { + /** + * Create a AutoscaleSettings. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByResourceGroup = _listByResourceGroup; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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); + } + } + + /** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, autoscaleSettingName, 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 autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, autoscaleSettingName, parameters, options, optionalCallback); + } + } + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, autoscaleSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, autoscaleSettingName, options, optionalCallback); + } + } + + /** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, autoscaleSettingName, 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 autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, autoscaleSettingName, options, optionalCallback); + } + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName, autoscaleSettingResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, optionalCallback); + } + } + + /** + * Lists the autoscale settings for a resource group + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(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 resource group + * + * @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. + */ + listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = AutoscaleSettings; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js new file mode 100644 index 0000000000..551dd62984 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js @@ -0,0 +1,479 @@ +/* + * 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; + +/** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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['DiagnosticSettingsCategoryResource']().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 diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 + * DiagnosticSettingsCategoryResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + 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['DiagnosticSettingsCategoryResourceCollection']().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 DiagnosticSettingsCategoryOperations. */ +class DiagnosticSettingsCategoryOperations { + /** + * Create a DiagnosticSettingsCategoryOperations. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._list = _list; + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceUri, name, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsCategoryResource} - 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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceUri, name, options, optionalCallback); + } + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, 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 diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsCategoryResourceCollection} - 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 + * DiagnosticSettingsCategoryResourceCollection} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = DiagnosticSettingsCategoryOperations; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js new file mode 100644 index 0000000000..be6f0864d9 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js @@ -0,0 +1,991 @@ +/* + * 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; + +/** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 DiagnosticSettingsResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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['DiagnosticSettingsResource']().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); + }); +} + +/** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri 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 (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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['DiagnosticSettingsResource']().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['DiagnosticSettingsResource']().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 existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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); + }); +} + +/** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 DiagnosticSettingsResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + 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['DiagnosticSettingsResourceCollection']().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 DiagnosticSettingsOperations. */ +class DiagnosticSettingsOperations { + /** + * Create a DiagnosticSettingsOperations. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._list = _list; + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceUri, name, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceUri, name, options, optionalCallback); + } + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, parameters, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceUri, parameters, name, 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 diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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(resourceUri, parameters, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceUri, parameters, name, options, optionalCallback); + } + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceUri, name, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceUri, name, options, optionalCallback); + } + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsResourceCollection} - 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 DiagnosticSettingsResourceCollection} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = DiagnosticSettingsOperations; diff --git a/lib/services/monitor/lib/lib/operations/eventCategories.js b/lib/services/monitor/lib/lib/operations/eventCategories.js new file mode 100644 index 0000000000..b9705aa81a --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/eventCategories.js @@ -0,0 +1,244 @@ +/* + * 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; + +/** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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 EventCategoryCollection} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/eventcategories'; + 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['EventCategoryCollection']().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 EventCategories. */ +class EventCategories { + /** + * Create a EventCategories. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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 {EventCategoryCollection} - 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 EventCategoryCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = EventCategories; diff --git a/lib/services/monitor/lib/lib/operations/index.d.ts b/lib/services/monitor/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..f6c6bd1a66 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/index.d.ts @@ -0,0 +1,4284 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as moment from 'moment'; +import * as models from '../models'; + + +/** + * @class + * AutoscaleSettings + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface AutoscaleSettings { + + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + + + /** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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. + * + * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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 {AutoscaleSettingResource} - 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. + * + * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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. + * + * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the autoscale settings for a resource group + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the autoscale settings for a resource group + * + * @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. + */ + 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; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AlertRuleIncidents + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface AlertRuleIncidents { + + + /** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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 {Incident} - 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. + * + * {Incident} [result] - The deserialized result object if an error did not occur. + * See {@link Incident} 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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, ruleName: string, incidentName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, ruleName: string, incidentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of incidents associated to an alert 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. + */ + listByAlertRuleWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of incidents associated to an alert 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 {IncidentListResult} - 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. + * + * {IncidentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link IncidentListResult} 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. + */ + listByAlertRule(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAlertRule(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; + listByAlertRule(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AlertRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface AlertRules { + + + /** + * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {AlertRuleResource} - 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. + * + * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResource} 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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an alert 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 an alert 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; + + + /** + * Gets an alert 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 alert 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 {AlertRuleResource} - 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. + * + * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResource} 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; + + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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 {AlertRuleResource} - 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. + * + * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResource} 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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; +} + +/** + * @class + * LogProfiles + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface LogProfiles { + + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(logProfileName: string, callback: ServiceCallback): void; + deleteMethod(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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 {LogProfileResource} - 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. + * + * {LogProfileResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileResource} 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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(logProfileName: string, callback: ServiceCallback): void; + get(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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. + * + * {LogProfileResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileResource} 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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, callback: ServiceCallback): void; + createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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. + * + * {LogProfileResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileResource} 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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, callback: ServiceCallback): void; + update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the log profiles. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the log profiles. + * + * @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 {LogProfileCollection} - 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. + * + * {LogProfileCollection} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileCollection} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DiagnosticSettingsOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface DiagnosticSettingsOperations { + + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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. + * + * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceUri: string, name: string, callback: ServiceCallback): void; + get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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. + * + * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsResource} 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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, callback: ServiceCallback): void; + createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceUri: string, name: string, callback: ServiceCallback): void; + deleteMethod(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsResourceCollection} - 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. + * + * {DiagnosticSettingsResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsResourceCollection} 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. + */ + list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DiagnosticSettingsCategoryOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface DiagnosticSettingsCategoryOperations { + + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsCategoryResource} - 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. + * + * {DiagnosticSettingsCategoryResource} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsCategoryResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceUri: string, name: string, callback: ServiceCallback): void; + get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsCategoryResourceCollection} - 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. + * + * {DiagnosticSettingsCategoryResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link + * DiagnosticSettingsCategoryResourceCollection} 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. + */ + list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActionGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ActionGroups { + + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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 {ActionGroupResource} - 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. + * + * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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 {ActionGroupResource} - 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. + * + * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupResource} 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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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 {ActionGroupResource} - 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. + * + * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, callback: ServiceCallback): void; + update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all action groups in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all action groups in 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 {ActionGroupList} - 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. + * + * {ActionGroupList} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupList} 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. + */ + listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionId(callback: ServiceCallback): void; + listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActionGroupList} - 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. + * + * {ActionGroupList} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiverWithHttpOperationResponse(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, callback: ServiceCallback): void; + enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActivityLogAlerts + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ActivityLogAlerts { + + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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. + * + * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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 {ActivityLogAlertResource} - 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. + * + * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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 {ActivityLogAlertResource} - 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. + * + * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, callback: ServiceCallback): void; + update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all activity log alerts in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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. + * + * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertList} 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. + */ + listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionId(callback: ServiceCallback): void; + listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActivityLogAlertList} - 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. + * + * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActivityLogs + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ActivityLogs { + + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Provides the list of records from the activity logs. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provides the list of records from the activity logs. + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * EventCategories + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface EventCategories { + + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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 {EventCategoryCollection} - 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. + * + * {EventCategoryCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventCategoryCollection} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TenantActivityLogs + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface TenantActivityLogs { + + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * MetricDefinitions + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricDefinitions { + + + /** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {MetricDefinitionCollection} - 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. + * + * {MetricDefinitionCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricDefinitionCollection} 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. + */ + list(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Metrics + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface Metrics { + + + /** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {Response} - 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. + * + * {Response} [result] - The deserialized result object if an error did not occur. + * See {@link Response} 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. + */ + list(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * MetricBaseline + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricBaseline { + + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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 {BaselineResponse} - 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. + * + * {BaselineResponse} [result] - The deserialized result object if an error did not occur. + * See {@link BaselineResponse} 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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceUri: string, metricName: string, callback: ServiceCallback): void; + get(resourceUri: string, metricName: string, options: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * **Lists the baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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. + */ + calculateBaselineWithHttpOperationResponse(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * **Lists the baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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 {CalculateBaselineResponse} - 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. + * + * {CalculateBaselineResponse} [result] - The deserialized result object if an error did not occur. + * See {@link CalculateBaselineResponse} 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. + */ + calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, callback: ServiceCallback): void; + calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * MetricAlerts + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricAlerts { + + + /** + * Retrieve alert rule definitions in 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>; + + /** + * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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. + * + * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResourceCollection} 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; + + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {MetricAlertResourceCollection} - 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. + * + * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResourceCollection} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve an alert rule definiton. + * + * @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>; + + /** + * Retrieve an alert rule definiton. + * + * @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 {MetricAlertResource} - 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. + * + * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResource} 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; + + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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. + * + * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResource} 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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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. + * + * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResource} 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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an alert rule defitiniton. + * + * @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>; + + /** + * Delete an alert rule defitiniton. + * + * @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; +} + +/** + * @class + * MetricAlertsStatus + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricAlertsStatus { + + + /** + * Retrieve an alert rule status. + * + * @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. + */ + listWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve an alert rule status. + * + * @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 {MetricAlertStatusCollection} - 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. + * + * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertStatusCollection} 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. + */ + list(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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. + */ + listByNameWithHttpOperationResponse(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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 {MetricAlertStatusCollection} - 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. + * + * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertStatusCollection} 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. + */ + listByName(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + 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; +} diff --git a/lib/services/monitor/lib/lib/operations/index.js b/lib/services/monitor/lib/lib/operations/index.js new file mode 100644 index 0000000000..56d8f5aa1b --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/index.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.AutoscaleSettings = require('./autoscaleSettings'); +exports.Operations = require('./operations'); +exports.AlertRuleIncidents = require('./alertRuleIncidents'); +exports.AlertRules = require('./alertRules'); +exports.LogProfiles = require('./logProfiles'); +exports.DiagnosticSettingsOperations = require('./diagnosticSettingsOperations'); +exports.DiagnosticSettingsCategoryOperations = require('./diagnosticSettingsCategoryOperations'); +exports.ActionGroups = require('./actionGroups'); +exports.ActivityLogAlerts = require('./activityLogAlerts'); +exports.ActivityLogs = require('./activityLogs'); +exports.EventCategories = require('./eventCategories'); +exports.TenantActivityLogs = require('./tenantActivityLogs'); +exports.MetricDefinitions = require('./metricDefinitions'); +exports.Metrics = require('./metrics'); +exports.MetricBaseline = require('./metricBaseline'); +exports.MetricAlerts = require('./metricAlerts'); +exports.MetricAlertsStatus = require('./metricAlertsStatus'); diff --git a/lib/services/monitor/lib/lib/operations/logProfiles.js b/lib/services/monitor/lib/lib/operations/logProfiles.js new file mode 100644 index 0000000000..8c61a074e5 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/logProfiles.js @@ -0,0 +1,1319 @@ +/* + * 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; + +/** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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 LogProfileResource} 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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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['LogProfileResource']().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); + }); +} + +/** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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 LogProfileResource} 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(logProfileName, 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 = '2016-03-01'; + // Validate + try { + if (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName 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.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/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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 = '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['LogProfileResource']().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) { + 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['LogProfileResource']().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); + }); +} + +/** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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 LogProfileResource} 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(logProfileName, logProfilesResource, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName cannot be null or undefined and it must be of type string.'); + } + if (logProfilesResource === null || logProfilesResource === undefined) { + throw new Error('logProfilesResource 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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 (logProfilesResource !== null && logProfilesResource !== undefined) { + let requestModelMapper = new client.models['LogProfileResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, logProfilesResource, 'logProfilesResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(logProfilesResource, 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['LogProfileResource']().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 profiles. + * + * @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 LogProfileCollection} 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 _list(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/logprofiles'; + 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['LogProfileCollection']().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 LogProfiles. */ +class LogProfiles { + /** + * Create a LogProfiles. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._list = _list; + } + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(logProfileName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(logProfileName, options, optionalCallback); + } + } + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(logProfileName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(logProfileName, options, optionalCallback); + } + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(logProfileName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(logProfileName, parameters, options, optionalCallback); + } + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName, logProfilesResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(logProfileName, logProfilesResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, logProfilesResource, 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(logProfileName, logProfilesResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(logProfileName, logProfilesResource, options, optionalCallback); + } + } + + /** + * List the log profiles. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 profiles. + * + * @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 {LogProfileCollection} - 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 LogProfileCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = LogProfiles; diff --git a/lib/services/monitor/lib/lib/operations/metricAlerts.js b/lib/services/monitor/lib/lib/operations/metricAlerts.js new file mode 100644 index 0000000000..d8cdf644dc --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricAlerts.js @@ -0,0 +1,1590 @@ +/* + * 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; +const moment = require('moment'); + +/** + * Retrieve alert rule definitions in 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 MetricAlertResourceCollection} 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 = '2018-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.Insight/metricAlerts'; + 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['MetricAlertResourceCollection']().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); + }); +} + +/** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 MetricAlertResourceCollection} 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 apiVersion = '2018-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 (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 (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.Insight/metricAlerts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['MetricAlertResourceCollection']().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); + }); +} + +/** + * Retrieve an alert rule definiton. + * + * @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 MetricAlertResource} 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-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 (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.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.Insight/metricAlerts/{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 = '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['MetricAlertResource']().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); + }); +} + +/** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 MetricAlertResource} 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-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 (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.Insight/metricAlerts/{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['MetricAlertResource']().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['MetricAlertResource']().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 an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 MetricAlertResource} 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-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 (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.Insight/metricAlerts/{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['MetricAlertResourcePatch']().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['MetricAlertResource']().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); + }); +} + +/** + * Delete an alert rule defitiniton. + * + * @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-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 (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.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.Insight/metricAlerts/{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 = '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) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a MetricAlerts. */ +class MetricAlerts { + /** + * Create a MetricAlerts. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + } + + /** + * Retrieve alert rule definitions in 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; + }); + }); + } + + /** + * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); + } + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); + } + } + + /** + * Retrieve an alert rule definiton. + * + * @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; + }); + }); + } + + /** + * Retrieve an alert rule definiton. + * + * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); + } + } + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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; + }); + }); + } + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); + } + } + + /** + * Update an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); + } + } + + /** + * Delete an alert rule defitiniton. + * + * @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; + }); + }); + } + + /** + * Delete an alert rule defitiniton. + * + * @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); + } + } + +} + +module.exports = MetricAlerts; diff --git a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js new file mode 100644 index 0000000000..7bd81a8494 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js @@ -0,0 +1,505 @@ +/* + * 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; + +/** + * Retrieve an alert rule status. + * + * @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 MetricAlertStatusCollection} 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 _list(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-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 (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.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.Insight/metricAlerts/{ruleName}/status'; + 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 = '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['MetricAlertStatusCollection']().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); + }); +} + +/** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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 MetricAlertStatusCollection} 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 _listByName(resourceGroupName, ruleName, statusName, 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-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 (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 (statusName === null || statusName === undefined || typeof statusName.valueOf() !== 'string') { + throw new Error('statusName 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.Insight/metricAlerts/{ruleName}/status/{statusName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{statusName}', encodeURIComponent(statusName)); + 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['MetricAlertStatusCollection']().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 MetricAlertsStatus. */ +class MetricAlertsStatus { + /** + * Create a MetricAlertsStatus. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByName = _listByName; + } + + /** + * Retrieve an alert rule status. + * + * @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. + */ + listWithHttpOperationResponse(resourceGroupName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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; + }); + }); + } + + /** + * Retrieve an alert rule status. + * + * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. + */ + list(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._list(resourceGroupName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, ruleName, options, optionalCallback); + } + } + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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. + */ + listByNameWithHttpOperationResponse(resourceGroupName, ruleName, statusName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. + */ + listByName(resourceGroupName, ruleName, statusName, 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._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByName(resourceGroupName, ruleName, statusName, options, optionalCallback); + } + } + +} + +module.exports = MetricAlertsStatus; diff --git a/lib/services/monitor/lib/lib/operations/metricBaseline.js b/lib/services/monitor/lib/lib/operations/metricBaseline.js new file mode 100644 index 0000000000..365ca4990c --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricBaseline.js @@ -0,0 +1,642 @@ +/* + * 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; +const moment = require('moment'); + +/** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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 BaselineResponse} 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(resourceUri, metricName, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; + let interval = (options && options.interval !== undefined) ? options.interval : undefined; + let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; + let sensitivities = (options && options.sensitivities !== undefined) ? options.sensitivities : undefined; + let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; + let apiVersion = '2017-11-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (metricName === null || metricName === undefined || typeof metricName.valueOf() !== 'string') { + throw new Error('metricName cannot be null or undefined and it must be of type string.'); + } + if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { + throw new Error('timespan must be of type string.'); + } + if(interval && !moment.isDuration(interval)) { + throw new Error('interval must be of type moment.duration.'); + } + if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { + throw new Error('aggregation must be of type string.'); + } + if (sensitivities !== null && sensitivities !== undefined && typeof sensitivities.valueOf() !== 'string') { + throw new Error('sensitivities must be of type string.'); + } + if (resultType) { + let allowedValues = [ 'Data', 'Metadata' ]; + if (!allowedValues.some( function(item) { return item === resultType; })) { + throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/baseline/{metricName}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{metricName}', encodeURIComponent(metricName)); + let queryParameters = []; + if (timespan !== null && timespan !== undefined) { + queryParameters.push('timespan=' + encodeURIComponent(timespan)); + } + if (interval !== null && interval !== undefined) { + queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); + } + if (aggregation !== null && aggregation !== undefined) { + queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); + } + if (sensitivities !== null && sensitivities !== undefined) { + queryParameters.push('sensitivities=' + encodeURIComponent(sensitivities)); + } + if (resultType !== null && resultType !== undefined) { + queryParameters.push('resultType=' + encodeURIComponent(resultType)); + } + 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['BaselineResponse']().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 baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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 CalculateBaselineResponse} 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 _calculateBaseline(resourceUri, timeSeriesInformation, 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 = '2017-11-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (timeSeriesInformation === null || timeSeriesInformation === undefined) { + throw new Error('timeSeriesInformation 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/calculatebaseline'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + 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 = 'POST'; + 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 (timeSeriesInformation !== null && timeSeriesInformation !== undefined) { + let requestModelMapper = new client.models['TimeSeriesInformation']().mapper(); + requestModel = client.serialize(requestModelMapper, timeSeriesInformation, 'timeSeriesInformation'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(timeSeriesInformation, 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['CalculateBaselineResponse']().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 MetricBaseline. */ +class MetricBaseline { + /** + * Create a MetricBaseline. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._calculateBaseline = _calculateBaseline; + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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(resourceUri, metricName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceUri, metricName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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 {BaselineResponse} - 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 BaselineResponse} 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(resourceUri, metricName, 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(resourceUri, metricName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceUri, metricName, options, optionalCallback); + } + } + + /** + * **Lists the baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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. + */ + calculateBaselineWithHttpOperationResponse(resourceUri, timeSeriesInformation, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._calculateBaseline(resourceUri, timeSeriesInformation, 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 baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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 {CalculateBaselineResponse} - 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 CalculateBaselineResponse} 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. + */ + calculateBaseline(resourceUri, timeSeriesInformation, 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._calculateBaseline(resourceUri, timeSeriesInformation, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._calculateBaseline(resourceUri, timeSeriesInformation, options, optionalCallback); + } + } + +} + +module.exports = MetricBaseline; diff --git a/lib/services/monitor/lib/lib/operations/metricDefinitions.js b/lib/services/monitor/lib/lib/operations/metricDefinitions.js new file mode 100644 index 0000000000..f3d1817183 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricDefinitions.js @@ -0,0 +1,264 @@ +/* + * 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; + +/** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 MetricDefinitionCollection} 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 _list(resourceUri, 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 metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; + let apiVersion = '2018-01-01'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { + throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metricDefinitions'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (metricnamespace !== null && metricnamespace !== undefined) { + queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); + } + 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['MetricDefinitionCollection']().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 MetricDefinitions. */ +class MetricDefinitions { + /** + * Create a MetricDefinitions. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, 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 metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {MetricDefinitionCollection} - 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 MetricDefinitionCollection} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = MetricDefinitions; diff --git a/lib/services/monitor/lib/lib/operations/metrics.js b/lib/services/monitor/lib/lib/operations/metrics.js new file mode 100644 index 0000000000..02d0aa5489 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metrics.js @@ -0,0 +1,430 @@ +/* + * 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; +const moment = require('moment'); + +/** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 Response} 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 _list(resourceUri, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; + let interval = (options && options.interval !== undefined) ? options.interval : undefined; + let metricnames = (options && options.metricnames !== undefined) ? options.metricnames : undefined; + let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; + let metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; + let apiVersion = '2018-01-01'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { + throw new Error('timespan must be of type string.'); + } + if(interval && !moment.isDuration(interval)) { + throw new Error('interval must be of type moment.duration.'); + } + if (metricnames !== null && metricnames !== undefined && typeof metricnames.valueOf() !== 'string') { + throw new Error('metricnames must be of type string.'); + } + if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { + throw new Error('aggregation must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (resultType) { + let allowedValues = [ 'Data', 'Metadata' ]; + if (!allowedValues.some( function(item) { return item === resultType; })) { + throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { + throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metrics'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + let queryParameters = []; + if (timespan !== null && timespan !== undefined) { + queryParameters.push('timespan=' + encodeURIComponent(timespan)); + } + if (interval !== null && interval !== undefined) { + queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); + } + if (metricnames !== null && metricnames !== undefined) { + queryParameters.push('metricnames=' + encodeURIComponent(metricnames)); + } + if (aggregation !== null && aggregation !== undefined) { + queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); + } + if (top !== null && top !== undefined) { + queryParameters.push('top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('orderby=' + encodeURIComponent(orderby)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (resultType !== null && resultType !== undefined) { + queryParameters.push('resultType=' + encodeURIComponent(resultType)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (metricnamespace !== null && metricnamespace !== undefined) { + queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); + } + 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['Response']().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 Metrics. */ +class Metrics { + /** + * Create a Metrics. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, 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 metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {Response} - 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 Response} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = Metrics; diff --git a/lib/services/monitor/lib/lib/operations/operations.js b/lib/services/monitor/lib/lib/operations/operations.js new file mode 100644 index 0000000000..664c03afa7 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/operations.js @@ -0,0 +1,235 @@ +/* + * 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; + +/** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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 OperationListResult} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/operations'; + 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['OperationListResult']().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 Operations. */ +class Operations { + /** + * Create a Operations. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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 {OperationListResult} - 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 OperationListResult} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js b/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js new file mode 100644 index 0000000000..7e523153c9 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js @@ -0,0 +1,565 @@ +/* + * 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; + +/** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; + let apiVersion = '2015-04-01'; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { + throw new Error('select 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('/') ? '' : '/') + 'providers/microsoft.insights/eventtypes/management/values'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (select !== null && select !== undefined) { + queryParameters.push('$select=' + encodeURIComponent(select)); + } + 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['EventDataCollection']().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); + }); +} + +/** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 TenantActivityLogs. */ +class TenantActivityLogs { + /** + * Create a TenantActivityLogs. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = TenantActivityLogs; diff --git a/lib/services/monitor/lib/package.json b/lib/services/monitor/lib/package.json new file mode 100644 index 0000000000..7a880c0fcf --- /dev/null +++ b/lib/services/monitor/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-monitor", + "author": "Microsoft Corporation", + "description": "MonitorManagementClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/monitorManagementClient.js", + "types": "./lib/monitorManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +} From 14e9dc2f7c984c302316a29401017c75393ce1c4 Mon Sep 17 00:00:00 2001 From: Dan Schulte Date: Thu, 29 Mar 2018 15:58:31 -0700 Subject: [PATCH 02/14] Regenerate monitor package --- codegen_mappings.json | 2 +- lib/services/monitor/README.md | 41 - lib/services/monitor/lib/LICENSE.txt | 21 - lib/services/monitor/lib/lib/models/action.js | 67 - .../monitor/lib/lib/models/actionGroupList.js | 61 - .../lib/lib/models/actionGroupPatchBody.js | 70 - .../lib/lib/models/actionGroupResource.js | 269 -- .../lib/models/activityLogAlertActionGroup.js | 70 - .../lib/models/activityLogAlertActionList.js | 62 - .../models/activityLogAlertAllOfCondition.js | 63 - .../models/activityLogAlertLeafCondition.js | 66 - .../lib/lib/models/activityLogAlertList.js | 61 - .../lib/models/activityLogAlertPatchBody.js | 70 - .../lib/models/activityLogAlertResource.js | 153 - .../lib/lib/models/alertRuleResource.js | 175 - .../lib/models/alertRuleResourceCollection.js | 59 - .../lib/lib/models/alertRuleResourcePatch.js | 143 - .../lib/models/automationRunbookReceiver.js | 95 - .../lib/lib/models/autoscaleNotification.js | 86 - .../lib/lib/models/autoscaleProfile.js | 204 - .../lib/models/autoscaleSettingResource.js | 159 - .../autoscaleSettingResourceCollection.js | 67 - .../models/autoscaleSettingResourcePatch.js | 126 - .../lib/lib/models/azureAppPushReceiver.js | 62 - .../monitor/lib/lib/models/baseline.js | 84 - .../lib/lib/models/baselineMetadataValue.js | 65 - .../lib/lib/models/baselineResponse.js | 154 - .../lib/models/calculateBaselineResponse.js | 85 - .../diagnosticSettingsCategoryResource.js | 82 - ...osticSettingsCategoryResourceCollection.js | 63 - .../lib/models/diagnosticSettingsResource.js | 142 - .../diagnosticSettingsResourceCollection.js | 62 - .../lib/lib/models/emailNotification.js | 78 - .../monitor/lib/lib/models/emailReceiver.js | 72 - .../monitor/lib/lib/models/enableRequest.js | 52 - .../monitor/lib/lib/models/errorResponse.js | 61 - .../lib/lib/models/eventCategoryCollection.js | 60 - .../monitor/lib/lib/models/eventData.js | 342 -- .../lib/lib/models/eventDataCollection.js | 68 - .../monitor/lib/lib/models/httpRequestInfo.js | 76 - .../monitor/lib/lib/models/incident.js | 93 - .../lib/lib/models/incidentListResult.js | 59 - .../monitor/lib/lib/models/index.d.ts | 2298 --------- lib/services/monitor/lib/lib/models/index.js | 131 - .../monitor/lib/lib/models/itsmReceiver.js | 89 - .../lib/lib/models/localizableString.js | 60 - .../models/locationThresholdRuleCondition.js | 96 - .../lib/lib/models/logProfileCollection.js | 59 - .../lib/lib/models/logProfileResource.js | 161 - .../lib/lib/models/logProfileResourcePatch.js | 129 - .../monitor/lib/lib/models/logSettings.js | 79 - .../managementEventAggregationCondition.js | 73 - .../models/managementEventRuleCondition.js | 94 - .../monitor/lib/lib/models/metadataValue.js | 65 - lib/services/monitor/lib/lib/models/metric.js | 102 - .../lib/lib/models/metricAlertCriteria.js | 70 - .../lib/lib/models/metricAlertResource.js | 208 - .../models/metricAlertResourceCollection.js | 59 - .../lib/models/metricAlertResourcePatch.js | 176 - ...ertSingleResourceMultipleMetricCriteria.js | 79 - .../lib/lib/models/metricAlertStatus.js | 84 - .../lib/models/metricAlertStatusCollection.js | 62 - .../lib/models/metricAlertStatusProperties.js | 75 - .../lib/lib/models/metricAvailability.js | 64 - .../monitor/lib/lib/models/metricCriteria.js | 110 - .../lib/lib/models/metricDefinition.js | 165 - .../lib/models/metricDefinitionCollection.js | 59 - .../monitor/lib/lib/models/metricDimension.js | 74 - .../monitor/lib/lib/models/metricSettings.js | 89 - .../monitor/lib/lib/models/metricTrigger.js | 125 - .../monitor/lib/lib/models/metricValue.js | 95 - .../monitor/lib/lib/models/operation.js | 68 - .../lib/lib/models/operationDisplay.js | 69 - .../lib/lib/models/operationListResult.js | 73 - .../lib/lib/models/proxyOnlyResource.js | 75 - .../monitor/lib/lib/models/recurrence.js | 114 - .../lib/lib/models/recurrentSchedule.js | 138 - .../monitor/lib/lib/models/resource.js | 98 - .../monitor/lib/lib/models/response.js | 113 - .../monitor/lib/lib/models/retentionPolicy.js | 65 - .../monitor/lib/lib/models/ruleAction.js | 59 - .../monitor/lib/lib/models/ruleCondition.js | 80 - .../monitor/lib/lib/models/ruleDataSource.js | 68 - .../monitor/lib/lib/models/ruleEmailAction.js | 88 - .../ruleManagementEventClaimsDataSource.js | 52 - .../models/ruleManagementEventDataSource.js | 145 - .../lib/lib/models/ruleMetricDataSource.js | 78 - .../lib/lib/models/ruleWebhookAction.js | 88 - .../monitor/lib/lib/models/scaleAction.js | 87 - .../monitor/lib/lib/models/scaleCapacity.js | 72 - .../monitor/lib/lib/models/scaleRule.js | 102 - .../lib/lib/models/senderAuthorization.js | 72 - .../monitor/lib/lib/models/smsReceiver.js | 80 - .../lib/lib/models/thresholdRuleCondition.js | 115 - .../lib/lib/models/timeSeriesElement.js | 81 - .../lib/lib/models/timeSeriesInformation.js | 90 - .../monitor/lib/lib/models/timeWindow.js | 105 - .../lib/lib/models/webhookNotification.js | 69 - .../monitor/lib/lib/models/webhookReceiver.js | 61 - .../lib/lib/monitorManagementClient.d.ts | 76 - .../lib/lib/monitorManagementClient.js | 100 - .../lib/lib/operations/actionGroups.js | 1810 ------- .../lib/lib/operations/activityLogAlerts.js | 1543 ------ .../lib/lib/operations/activityLogs.js | 545 --- .../lib/lib/operations/alertRuleIncidents.js | 500 -- .../monitor/lib/lib/operations/alertRules.js | 1423 ------ .../lib/lib/operations/autoscaleSettings.js | 1561 ------ .../diagnosticSettingsCategoryOperations.js | 479 -- .../diagnosticSettingsOperations.js | 991 ---- .../lib/lib/operations/eventCategories.js | 244 - .../monitor/lib/lib/operations/index.d.ts | 4284 ----------------- .../monitor/lib/lib/operations/index.js | 33 - .../monitor/lib/lib/operations/logProfiles.js | 1319 ----- .../lib/lib/operations/metricAlerts.js | 1590 ------ .../lib/lib/operations/metricAlertsStatus.js | 505 -- .../lib/lib/operations/metricBaseline.js | 642 --- .../lib/lib/operations/metricDefinitions.js | 264 - .../monitor/lib/lib/operations/metrics.js | 430 -- .../monitor/lib/lib/operations/operations.js | 235 - .../lib/lib/operations/tenantActivityLogs.js | 565 --- lib/services/monitor/lib/package.json | 22 - lib/services/monitor/package.json | 44 - .../lib/models/actionGroupResource.js | 51 + .../lib/models/azureFunctionReceiver.js | 0 .../monitorManagement/lib/models/index.d.ts | 64 + .../monitorManagement/lib/models/index.js | 3 + .../lib/models/logicAppReceiver.js | 0 .../lib/models/voiceReceiver.js | 0 .../lib/operations/actionGroups.js | 41 +- .../lib/operations/index.d.ts | 18 + lib/services/monitorManagement/package.json | 2 +- 131 files changed, 172 insertions(+), 30597 deletions(-) delete mode 100644 lib/services/monitor/README.md delete mode 100644 lib/services/monitor/lib/LICENSE.txt delete mode 100644 lib/services/monitor/lib/lib/models/action.js delete mode 100644 lib/services/monitor/lib/lib/models/actionGroupList.js delete mode 100644 lib/services/monitor/lib/lib/models/actionGroupPatchBody.js delete mode 100644 lib/services/monitor/lib/lib/models/actionGroupResource.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionList.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertList.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertResource.js delete mode 100644 lib/services/monitor/lib/lib/models/alertRuleResource.js delete mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/automationRunbookReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleNotification.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleProfile.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResource.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/azureAppPushReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/baseline.js delete mode 100644 lib/services/monitor/lib/lib/models/baselineMetadataValue.js delete mode 100644 lib/services/monitor/lib/lib/models/baselineResponse.js delete mode 100644 lib/services/monitor/lib/lib/models/calculateBaselineResponse.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/emailNotification.js delete mode 100644 lib/services/monitor/lib/lib/models/emailReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/enableRequest.js delete mode 100644 lib/services/monitor/lib/lib/models/errorResponse.js delete mode 100644 lib/services/monitor/lib/lib/models/eventCategoryCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/eventData.js delete mode 100644 lib/services/monitor/lib/lib/models/eventDataCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/httpRequestInfo.js delete mode 100644 lib/services/monitor/lib/lib/models/incident.js delete mode 100644 lib/services/monitor/lib/lib/models/incidentListResult.js delete mode 100644 lib/services/monitor/lib/lib/models/index.d.ts delete mode 100644 lib/services/monitor/lib/lib/models/index.js delete mode 100644 lib/services/monitor/lib/lib/models/itsmReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/localizableString.js delete mode 100644 lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/logProfileCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/logProfileResource.js delete mode 100644 lib/services/monitor/lib/lib/models/logProfileResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/logSettings.js delete mode 100644 lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/managementEventRuleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/metadataValue.js delete mode 100644 lib/services/monitor/lib/lib/models/metric.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertCriteria.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertResource.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatus.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAvailability.js delete mode 100644 lib/services/monitor/lib/lib/models/metricCriteria.js delete mode 100644 lib/services/monitor/lib/lib/models/metricDefinition.js delete mode 100644 lib/services/monitor/lib/lib/models/metricDefinitionCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/metricDimension.js delete mode 100644 lib/services/monitor/lib/lib/models/metricSettings.js delete mode 100644 lib/services/monitor/lib/lib/models/metricTrigger.js delete mode 100644 lib/services/monitor/lib/lib/models/metricValue.js delete mode 100644 lib/services/monitor/lib/lib/models/operation.js delete mode 100644 lib/services/monitor/lib/lib/models/operationDisplay.js delete mode 100644 lib/services/monitor/lib/lib/models/operationListResult.js delete mode 100644 lib/services/monitor/lib/lib/models/proxyOnlyResource.js delete mode 100644 lib/services/monitor/lib/lib/models/recurrence.js delete mode 100644 lib/services/monitor/lib/lib/models/recurrentSchedule.js delete mode 100644 lib/services/monitor/lib/lib/models/resource.js delete mode 100644 lib/services/monitor/lib/lib/models/response.js delete mode 100644 lib/services/monitor/lib/lib/models/retentionPolicy.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleAction.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleEmailAction.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleMetricDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleWebhookAction.js delete mode 100644 lib/services/monitor/lib/lib/models/scaleAction.js delete mode 100644 lib/services/monitor/lib/lib/models/scaleCapacity.js delete mode 100644 lib/services/monitor/lib/lib/models/scaleRule.js delete mode 100644 lib/services/monitor/lib/lib/models/senderAuthorization.js delete mode 100644 lib/services/monitor/lib/lib/models/smsReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/thresholdRuleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/timeSeriesElement.js delete mode 100644 lib/services/monitor/lib/lib/models/timeSeriesInformation.js delete mode 100644 lib/services/monitor/lib/lib/models/timeWindow.js delete mode 100644 lib/services/monitor/lib/lib/models/webhookNotification.js delete mode 100644 lib/services/monitor/lib/lib/models/webhookReceiver.js delete mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.d.ts delete mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.js delete mode 100644 lib/services/monitor/lib/lib/operations/actionGroups.js delete mode 100644 lib/services/monitor/lib/lib/operations/activityLogAlerts.js delete mode 100644 lib/services/monitor/lib/lib/operations/activityLogs.js delete mode 100644 lib/services/monitor/lib/lib/operations/alertRuleIncidents.js delete mode 100644 lib/services/monitor/lib/lib/operations/alertRules.js delete mode 100644 lib/services/monitor/lib/lib/operations/autoscaleSettings.js delete mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js delete mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js delete mode 100644 lib/services/monitor/lib/lib/operations/eventCategories.js delete mode 100644 lib/services/monitor/lib/lib/operations/index.d.ts delete mode 100644 lib/services/monitor/lib/lib/operations/index.js delete mode 100644 lib/services/monitor/lib/lib/operations/logProfiles.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricAlerts.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricAlertsStatus.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricBaseline.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricDefinitions.js delete mode 100644 lib/services/monitor/lib/lib/operations/metrics.js delete mode 100644 lib/services/monitor/lib/lib/operations/operations.js delete mode 100644 lib/services/monitor/lib/lib/operations/tenantActivityLogs.js delete mode 100644 lib/services/monitor/lib/package.json delete mode 100644 lib/services/monitor/package.json rename lib/services/{monitor/lib => monitorManagement}/lib/models/azureFunctionReceiver.js (100%) rename lib/services/{monitor/lib => monitorManagement}/lib/models/logicAppReceiver.js (100%) rename lib/services/{monitor/lib => monitorManagement}/lib/models/voiceReceiver.js (100%) diff --git a/codegen_mappings.json b/codegen_mappings.json index a2a89d012d..dceffb4c73 100644 --- a/codegen_mappings.json +++ b/codegen_mappings.json @@ -431,7 +431,7 @@ "monitor": { "resource-manager": { "packageName": "azure-arm-monitor", - "packageVersion": "2.0.0-preview", + "packageVersion": "2.1.0-preview", "generateLicenseTxt": true, "generatePackageJson": true, "generateReadmeMd": true, diff --git a/lib/services/monitor/README.md b/lib/services/monitor/README.md deleted file mode 100644 index b97266e4fe..0000000000 --- a/lib/services/monitor/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Microsoft Azure SDK for Node.js - Azure Monitor Management - -### **The contents of this SDK have been moved to [azure-arm-monitor](https://www.npmjs.com/package/azure-arm-monitor) and this SDK has been deprecated. Please change your dependency from azure-monitor to [azure-arm-monitor](https://www.npmjs.com/package/azure-arm-monitor).** - -This project provides a Node.js package that makes it easy to use the Azure Monitor API. Right now it supports: -- **Node.js version: 6.x or higher** - -## How to Install - -```bash -npm install azure-monitor -``` - -## How to Use - -### Authentication, client creation and listing activityLogs as an example. - - ```javascript - const msRestAzure = require('ms-rest-azure'); - const monitorClient = require('azure-monitor'); - - // Interactive Login - // It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful, - // the user will get a DeviceTokenCredentials object. - msRestAzure.interactiveLogin().then((credentials) => { - let client = new monitorManagementClient(credentials, 'your-subscription-id'); - return client.activityLogs.list(); - }).then((activityLogs) => { - console.log('List of activityLogs:'); - console.dir(activityLogs, {depth: null, colors: true}); - return; -}).catch((err) => { - console.log('An error ocurred'); - console.dir(err, {depth: null, colors: true}); - return; -}); - ``` - -## Related projects - -- [Microsoft Azure SDK for Node.js - All-up](https://github.com/WindowsAzure/azure-sdk-for-node) diff --git a/lib/services/monitor/lib/LICENSE.txt b/lib/services/monitor/lib/LICENSE.txt deleted file mode 100644 index 5431ba98b9..0000000000 --- a/lib/services/monitor/lib/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -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/monitor/lib/lib/models/action.js b/lib/services/monitor/lib/lib/models/action.js deleted file mode 100644 index 91eaf1b94d..0000000000 --- a/lib/services/monitor/lib/lib/models/action.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 Action { - /** - * Create a Action. - * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] - */ - constructor() { - } - - /** - * Defines the metadata of Action - * - * @returns {object} metadata of Action - * - */ - mapper() { - return { - required: false, - serializedName: 'Action', - type: { - name: 'Composite', - className: 'Action', - 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 = Action; diff --git a/lib/services/monitor/lib/lib/models/actionGroupList.js b/lib/services/monitor/lib/lib/models/actionGroupList.js deleted file mode 100644 index 686e1c81f9..0000000000 --- a/lib/services/monitor/lib/lib/models/actionGroupList.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 list of action groups. - */ -class ActionGroupList extends Array { - /** - * Create a ActionGroupList. - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ActionGroupList - * - * @returns {object} metadata of ActionGroupList - * - */ - mapper() { - return { - required: false, - serializedName: 'ActionGroupList', - type: { - name: 'Composite', - className: 'ActionGroupList', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionGroupResourceElementType', - type: { - name: 'Composite', - className: 'ActionGroupResource' - } - } - } - } - } - } - }; - } -} - -module.exports = ActionGroupList; diff --git a/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js b/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js deleted file mode 100644 index c55155969f..0000000000 --- a/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 action group object for the body of patch operations. - * - */ -class ActionGroupPatchBody { - /** - * Create a ActionGroupPatchBody. - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its actions will - * be activated. Default value: true . - */ - constructor() { - } - - /** - * Defines the metadata of ActionGroupPatchBody - * - * @returns {object} metadata of ActionGroupPatchBody - * - */ - mapper() { - return { - required: false, - serializedName: 'ActionGroupPatchBody', - type: { - name: 'Composite', - className: 'ActionGroupPatchBody', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ActionGroupPatchBody; diff --git a/lib/services/monitor/lib/lib/models/actionGroupResource.js b/lib/services/monitor/lib/lib/models/actionGroupResource.js deleted file mode 100644 index 9a443885a8..0000000000 --- a/lib/services/monitor/lib/lib/models/actionGroupResource.js +++ /dev/null @@ -1,269 +0,0 @@ -/* - * 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'); - -/** - * An action group resource. - * - * @extends models['Resource'] - */ -class ActionGroupResource extends models['Resource'] { - /** - * Create a ActionGroupResource. - * @member {string} groupShortName The short name of the action group. This - * will be used in SMS messages. - * @member {boolean} enabled Indicates whether this action group is enabled. - * If an action group is not enabled, then none of its receivers will receive - * communications. Default value: true . - * @member {array} [emailReceivers] The list of email receivers that are part - * of this action group. - * @member {array} [smsReceivers] The list of SMS receivers that are part of - * this action group. - * @member {array} [webhookReceivers] The list of webhook receivers that are - * part of this action group. - * @member {array} [itsmReceivers] The list of ITSM receivers that are part - * of this action group. - * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers - * 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(); - } - - /** - * Defines the metadata of ActionGroupResource - * - * @returns {object} metadata of ActionGroupResource - * - */ - mapper() { - return { - required: false, - serializedName: 'ActionGroupResource', - type: { - name: 'Composite', - className: 'ActionGroupResource', - 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' - } - } - } - }, - groupShortName: { - required: true, - serializedName: 'properties.groupShortName', - constraints: { - MaxLength: 15 - }, - type: { - name: 'String' - } - }, - enabled: { - required: true, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - emailReceivers: { - required: false, - serializedName: 'properties.emailReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'EmailReceiverElementType', - type: { - name: 'Composite', - className: 'EmailReceiver' - } - } - } - }, - smsReceivers: { - required: false, - serializedName: 'properties.smsReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'SmsReceiverElementType', - type: { - name: 'Composite', - className: 'SmsReceiver' - } - } - } - }, - webhookReceivers: { - required: false, - serializedName: 'properties.webhookReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'WebhookReceiverElementType', - type: { - name: 'Composite', - className: 'WebhookReceiver' - } - } - } - }, - itsmReceivers: { - required: false, - serializedName: 'properties.itsmReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ItsmReceiverElementType', - type: { - name: 'Composite', - className: 'ItsmReceiver' - } - } - } - }, - azureAppPushReceivers: { - required: false, - serializedName: 'properties.azureAppPushReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AzureAppPushReceiverElementType', - type: { - name: 'Composite', - className: 'AzureAppPushReceiver' - } - } - } - }, - automationRunbookReceivers: { - required: false, - serializedName: 'properties.automationRunbookReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutomationRunbookReceiverElementType', - type: { - name: 'Composite', - className: 'AutomationRunbookReceiver' - } - } - } - }, - 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' - } - } - } - } - } - } - }; - } -} - -module.exports = ActionGroupResource; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js deleted file mode 100644 index 727c96320c..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 pointer to an Azure Action Group. - * - */ -class ActivityLogAlertActionGroup { - /** - * Create a ActivityLogAlertActionGroup. - * @member {string} actionGroupId The resourceId of the action group. This - * cannot be null or empty. - * @member {object} [webhookProperties] the dictionary of custom properties - * to include with the post operation. These data are appended to the webhook - * payload. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertActionGroup - * - * @returns {object} metadata of ActivityLogAlertActionGroup - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertActionGroup', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionGroup', - modelProperties: { - actionGroupId: { - required: true, - serializedName: 'actionGroupId', - type: { - name: 'String' - } - }, - webhookProperties: { - required: false, - serializedName: 'webhookProperties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertActionGroup; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js deleted file mode 100644 index 2de7dd16fe..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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'); - -/** - * A list of activity log alert actions. - * - */ -class ActivityLogAlertActionList { - /** - * Create a ActivityLogAlertActionList. - * @member {array} [actionGroups] The list of activity log alerts. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertActionList - * - * @returns {object} metadata of ActivityLogAlertActionList - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertActionList', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionList', - modelProperties: { - actionGroups: { - required: false, - serializedName: 'actionGroups', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActivityLogAlertActionGroupElementType', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionGroup' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertActionList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js deleted file mode 100644 index 234f03ce70..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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'); - -/** - * An Activity Log alert condition that is met when all its member conditions - * are met. - * - */ -class ActivityLogAlertAllOfCondition { - /** - * Create a ActivityLogAlertAllOfCondition. - * @member {array} allOf The list of activity log alert conditions. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertAllOfCondition - * - * @returns {object} metadata of ActivityLogAlertAllOfCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertAllOfCondition', - type: { - name: 'Composite', - className: 'ActivityLogAlertAllOfCondition', - modelProperties: { - allOf: { - required: true, - serializedName: 'allOf', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActivityLogAlertLeafConditionElementType', - type: { - name: 'Composite', - className: 'ActivityLogAlertLeafCondition' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertAllOfCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js deleted file mode 100644 index df05750642..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 Activity Log alert condition that is met by comparing an activity log - * field and value. - * - */ -class ActivityLogAlertLeafCondition { - /** - * Create a ActivityLogAlertLeafCondition. - * @member {string} field The name of the field that this condition will - * examine. The possible values for this field are (case-insensitive): - * 'resourceId', 'category', 'caller', 'level', 'operationName', - * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', - * 'resourceType', or anything beginning with 'properties.'. - * @member {string} equals The field value will be compared to this value - * (case-insensitive) to determine if the condition is met. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertLeafCondition - * - * @returns {object} metadata of ActivityLogAlertLeafCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertLeafCondition', - type: { - name: 'Composite', - className: 'ActivityLogAlertLeafCondition', - modelProperties: { - field: { - required: true, - serializedName: 'field', - type: { - name: 'String' - } - }, - equals: { - required: true, - serializedName: 'equals', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertLeafCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertList.js b/lib/services/monitor/lib/lib/models/activityLogAlertList.js deleted file mode 100644 index 6379f702f8..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertList.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 list of activity log alerts. - */ -class ActivityLogAlertList extends Array { - /** - * Create a ActivityLogAlertList. - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ActivityLogAlertList - * - * @returns {object} metadata of ActivityLogAlertList - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertList', - type: { - name: 'Composite', - className: 'ActivityLogAlertList', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActivityLogAlertResourceElementType', - type: { - name: 'Composite', - className: 'ActivityLogAlertResource' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js b/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js deleted file mode 100644 index aa120768da..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 activity log alert object for the body of patch operations. - * - */ -class ActivityLogAlertPatchBody { - /** - * Create a ActivityLogAlertPatchBody. - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertPatchBody - * - * @returns {object} metadata of ActivityLogAlertPatchBody - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertPatchBody', - type: { - name: 'Composite', - className: 'ActivityLogAlertPatchBody', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertPatchBody; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertResource.js b/lib/services/monitor/lib/lib/models/activityLogAlertResource.js deleted file mode 100644 index dc857e34d9..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertResource.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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'); - -/** - * An activity log alert resource. - * - * @extends models['Resource'] - */ -class ActivityLogAlertResource extends models['Resource'] { - /** - * Create a ActivityLogAlertResource. - * @member {array} scopes A list of resourceIds that will be used as - * prefixes. The alert will only apply to activityLogs with resourceIds that - * fall under one of these prefixes. This list must include at least one - * item. - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - * @member {object} condition The condition that will cause this alert to - * activate. - * @member {array} [condition.allOf] The list of activity log alert - * conditions. - * @member {object} actions The actions that will activate when the condition - * is met. - * @member {array} [actions.actionGroups] The list of activity log alerts. - * @member {string} [description] A description of this activity log alert. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ActivityLogAlertResource - * - * @returns {object} metadata of ActivityLogAlertResource - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertResource', - type: { - name: 'Composite', - className: 'ActivityLogAlertResource', - 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' - } - } - } - }, - scopes: { - required: true, - serializedName: 'properties.scopes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - condition: { - required: true, - serializedName: 'properties.condition', - type: { - name: 'Composite', - className: 'ActivityLogAlertAllOfCondition' - } - }, - actions: { - required: true, - serializedName: 'properties.actions', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionList' - } - }, - description: { - required: false, - serializedName: 'properties.description', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResource.js b/lib/services/monitor/lib/lib/models/alertRuleResource.js deleted file mode 100644 index 40978cb847..0000000000 --- a/lib/services/monitor/lib/lib/models/alertRuleResource.js +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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 alert rule resource. - * - * @extends models['Resource'] - */ -class AlertRuleResource extends models['Resource'] { - /** - * Create a AlertRuleResource. - * @member {string} alertRuleResourceName the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property - * cannot be updated for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic - * Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AlertRuleResource - * - * @returns {object} metadata of AlertRuleResource - * - */ - mapper() { - return { - required: false, - serializedName: 'AlertRuleResource', - type: { - name: 'Composite', - className: 'AlertRuleResource', - 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' - } - } - } - }, - alertRuleResourceName: { - required: true, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - description: { - required: false, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - isEnabled: { - required: true, - serializedName: 'properties.isEnabled', - type: { - name: 'Boolean' - } - }, - condition: { - required: true, - serializedName: 'properties.condition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'RuleCondition' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'RuleActionElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleAction' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = AlertRuleResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js b/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js deleted file mode 100644 index 40dd02b71e..0000000000 --- a/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 alert rule resources. - */ -class AlertRuleResourceCollection extends Array { - /** - * Create a AlertRuleResourceCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AlertRuleResourceCollection - * - * @returns {object} metadata of AlertRuleResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'AlertRuleResourceCollection', - type: { - name: 'Composite', - className: 'AlertRuleResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AlertRuleResourceElementType', - type: { - name: 'Composite', - className: 'AlertRuleResource' - } - } - } - } - } - } - }; - } -} - -module.exports = AlertRuleResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js b/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js deleted file mode 100644 index 3094d95d8b..0000000000 --- a/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 alert rule object for patch operations. - * - */ -class AlertRuleResourcePatch { - /** - * Create a AlertRuleResourcePatch. - * @member {object} [tags] Resource tags - * @member {string} name the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property - * cannot be updated for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic - * Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - } - - /** - * Defines the metadata of AlertRuleResourcePatch - * - * @returns {object} metadata of AlertRuleResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'AlertRuleResourcePatch', - type: { - name: 'Composite', - className: 'AlertRuleResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - name: { - required: true, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - description: { - required: false, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - isEnabled: { - required: true, - serializedName: 'properties.isEnabled', - type: { - name: 'Boolean' - } - }, - condition: { - required: true, - serializedName: 'properties.condition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'RuleCondition' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'RuleActionElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleAction' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = AlertRuleResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js b/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js deleted file mode 100644 index b54ae4d250..0000000000 --- a/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 Azure Automation Runbook notification receiver. - * - */ -class AutomationRunbookReceiver { - /** - * Create a AutomationRunbookReceiver. - * @member {string} automationAccountId The Azure automation account Id which - * holds this runbook and authenticate to Azure resource. - * @member {string} runbookName The name for this runbook. - * @member {string} webhookResourceId The resource id for webhook linked to - * this runbook. - * @member {boolean} isGlobalRunbook Indicates whether this instance is - * global runbook. - * @member {string} [name] Indicates name of the webhook. - * @member {string} [serviceUri] The URI where webhooks should be sent. - */ - constructor() { - } - - /** - * Defines the metadata of AutomationRunbookReceiver - * - * @returns {object} metadata of AutomationRunbookReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'AutomationRunbookReceiver', - type: { - name: 'Composite', - className: 'AutomationRunbookReceiver', - modelProperties: { - automationAccountId: { - required: true, - serializedName: 'automationAccountId', - type: { - name: 'String' - } - }, - runbookName: { - required: true, - serializedName: 'runbookName', - type: { - name: 'String' - } - }, - webhookResourceId: { - required: true, - serializedName: 'webhookResourceId', - type: { - name: 'String' - } - }, - isGlobalRunbook: { - required: true, - serializedName: 'isGlobalRunbook', - type: { - name: 'Boolean' - } - }, - name: { - required: false, - serializedName: 'name', - type: { - name: 'String' - } - }, - serviceUri: { - required: false, - serializedName: 'serviceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutomationRunbookReceiver; diff --git a/lib/services/monitor/lib/lib/models/autoscaleNotification.js b/lib/services/monitor/lib/lib/models/autoscaleNotification.js deleted file mode 100644 index d56fcbc701..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleNotification.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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'); - -/** - * Autoscale notification. - * - */ -class AutoscaleNotification { - /** - * Create a AutoscaleNotification. - * @member {object} [email] the email notification. - * @member {boolean} [email.sendToSubscriptionAdministrator] a value - * indicating whether to send email to subscription administrator. - * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value - * indicating whether to send email to subscription co-administrators. - * @member {array} [email.customEmails] the custom e-mails list. This value - * can be null or empty, in which case this attribute will be ignored. - * @member {array} [webhooks] the collection of webhook notifications. - */ - constructor() { - } - - /** - * Defines the metadata of AutoscaleNotification - * - * @returns {object} metadata of AutoscaleNotification - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleNotification', - type: { - name: 'Composite', - className: 'AutoscaleNotification', - modelProperties: { - operation: { - required: true, - isConstant: true, - serializedName: 'operation', - defaultValue: 'Scale', - type: { - name: 'String' - } - }, - email: { - required: false, - serializedName: 'email', - type: { - name: 'Composite', - className: 'EmailNotification' - } - }, - webhooks: { - required: false, - serializedName: 'webhooks', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'WebhookNotificationElementType', - type: { - name: 'Composite', - className: 'WebhookNotification' - } - } - } - } - } - } - }; - } -} - -module.exports = AutoscaleNotification; diff --git a/lib/services/monitor/lib/lib/models/autoscaleProfile.js b/lib/services/monitor/lib/lib/models/autoscaleProfile.js deleted file mode 100644 index a26c7a898f..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleProfile.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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'); - -/** - * Autoscale profile. - * - */ -class AutoscaleProfile { - /** - * Create a AutoscaleProfile. - * @member {string} name the name of the profile. - * @member {object} capacity the number of instances that can be used during - * this profile. - * @member {string} [capacity.minimum] the minimum number of instances for - * the resource. - * @member {string} [capacity.maximum] the maximum number of instances for - * the resource. The actual maximum number of instances is limited by the - * cores that are available in the subscription. - * @member {string} [capacity.default] the number of instances that will be - * set if metrics are not available for evaluation. The default is only used - * if the current instance count is lower than the default. - * @member {array} rules the collection of rules that provide the triggers - * and parameters for the scaling action. A maximum of 10 rules can be - * specified. - * @member {object} [fixedDate] the specific date-time for the profile. This - * element is not used if the Recurrence element is used. - * @member {string} [fixedDate.timeZone] the timezone of the start and end - * times for the profile. Some examples of valid timezones are: Dateline - * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain - * Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, - * Central America Standard Time, Central Standard Time, Central Standard - * Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, - * Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, - * Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard - * Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland - * Standard Time, E. South America Standard Time, Argentina Standard Time, SA - * Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, - * Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard - * Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard - * Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe - * Standard Time, Romance Standard Time, Central European Standard Time, W. - * Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, - * GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria - * Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE - * Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad - * Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard - * Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard - * Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, - * Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, - * Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard - * Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard - * Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard - * Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar - * Standard Time, SE Asia Standard Time, North Asia Standard Time, China - * Standard Time, North Asia East Standard Time, Singapore Standard Time, W. - * Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia - * Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New - * Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard - * Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {date} [fixedDate.start] the start time for the profile in ISO - * 8601 format. - * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 - * 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 - * of the profile. Some examples of valid timezones are: Dateline Standard - * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - * Mountain Standard Time (Mexico), Mountain Standard Time, Central America - * Standard Time, Central Standard Time, Central Standard Time (Mexico), - * Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard - * Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard - * Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western - * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. - * South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [recurrence.schedule.days] the collection of days that the - * profile takes effect on. Possible values are Sunday through Saturday. - * @member {array} [recurrence.schedule.hours] A collection of hours that the - * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock - * (AM/PM times are not supported). - * @member {array} [recurrence.schedule.minutes] A collection of minutes at - * which the profile takes effect at. - */ - constructor() { - } - - /** - * Defines the metadata of AutoscaleProfile - * - * @returns {object} metadata of AutoscaleProfile - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleProfile', - type: { - name: 'Composite', - className: 'AutoscaleProfile', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - capacity: { - required: true, - serializedName: 'capacity', - type: { - name: 'Composite', - className: 'ScaleCapacity' - } - }, - rules: { - required: true, - serializedName: 'rules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ScaleRuleElementType', - type: { - name: 'Composite', - className: 'ScaleRule' - } - } - } - }, - fixedDate: { - required: false, - serializedName: 'fixedDate', - type: { - name: 'Composite', - className: 'TimeWindow' - } - }, - recurrence: { - required: false, - serializedName: 'recurrence', - type: { - name: 'Composite', - className: 'Recurrence' - } - } - } - } - }; - } -} - -module.exports = AutoscaleProfile; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js deleted file mode 100644 index d5363c2f72..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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 autoscale setting resource. - * - * @extends models['Resource'] - */ -class AutoscaleSettingResource extends models['Resource'] { - /** - * Create a AutoscaleSettingResource. - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [autoscaleSettingResourceName] the name of the autoscale - * setting. - * @member {string} [targetResourceUri] the resource identifier of the - * resource that the autoscale setting should be added to. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AutoscaleSettingResource - * - * @returns {object} metadata of AutoscaleSettingResource - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleSettingResource', - type: { - name: 'Composite', - className: 'AutoscaleSettingResource', - 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' - } - } - } - }, - profiles: { - required: true, - serializedName: 'properties.profiles', - constraints: { - MaxItems: 20 - }, - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleProfileElementType', - type: { - name: 'Composite', - className: 'AutoscaleProfile' - } - } - } - }, - notifications: { - required: false, - serializedName: 'properties.notifications', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleNotificationElementType', - type: { - name: 'Composite', - className: 'AutoscaleNotification' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - autoscaleSettingResourceName: { - required: false, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - targetResourceUri: { - required: false, - serializedName: 'properties.targetResourceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutoscaleSettingResource; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js deleted file mode 100644 index 0f0ca6ac53..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 autoscale setting resources. - */ -class AutoscaleSettingResourceCollection extends Array { - /** - * Create a AutoscaleSettingResourceCollection. - * @member {string} [nextLink] URL to get the next set of results. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AutoscaleSettingResourceCollection - * - * @returns {object} metadata of AutoscaleSettingResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleSettingResourceCollection', - type: { - name: 'Composite', - className: 'AutoscaleSettingResourceCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleSettingResourceElementType', - type: { - name: 'Composite', - className: 'AutoscaleSettingResource' - } - } - } - }, - nextLink: { - required: false, - serializedName: 'nextLink', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutoscaleSettingResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js deleted file mode 100644 index fe1ac2f14a..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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 autoscale setting object for patch operations. - * - */ -class AutoscaleSettingResourcePatch { - /** - * Create a AutoscaleSettingResourcePatch. - * @member {object} [tags] Resource tags - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [name] the name of the autoscale setting. - * @member {string} [targetResourceUri] the resource identifier of the - * resource that the autoscale setting should be added to. - */ - constructor() { - } - - /** - * Defines the metadata of AutoscaleSettingResourcePatch - * - * @returns {object} metadata of AutoscaleSettingResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleSettingResourcePatch', - type: { - name: 'Composite', - className: 'AutoscaleSettingResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - profiles: { - required: true, - serializedName: 'properties.profiles', - constraints: { - MaxItems: 20 - }, - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleProfileElementType', - type: { - name: 'Composite', - className: 'AutoscaleProfile' - } - } - } - }, - notifications: { - required: false, - serializedName: 'properties.notifications', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleNotificationElementType', - type: { - name: 'Composite', - className: 'AutoscaleNotification' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - name: { - required: false, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - targetResourceUri: { - required: false, - serializedName: 'properties.targetResourceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutoscaleSettingResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js b/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js deleted file mode 100644 index 0360bb90f0..0000000000 --- a/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 Azure mobile App push notification receiver. - * - */ -class AzureAppPushReceiver { - /** - * Create a AzureAppPushReceiver. - * @member {string} name The name of the Azure mobile app push receiver. - * Names must be unique across all receivers within an action group. - * @member {string} emailAddress The email address registered for the Azure - * mobile app. - */ - constructor() { - } - - /** - * Defines the metadata of AzureAppPushReceiver - * - * @returns {object} metadata of AzureAppPushReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'AzureAppPushReceiver', - type: { - name: 'Composite', - className: 'AzureAppPushReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - emailAddress: { - required: true, - serializedName: 'emailAddress', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AzureAppPushReceiver; diff --git a/lib/services/monitor/lib/lib/models/baseline.js b/lib/services/monitor/lib/lib/models/baseline.js deleted file mode 100644 index ffd9d6f3eb..0000000000 --- a/lib/services/monitor/lib/lib/models/baseline.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 baseline values for a single sensitivity value. - * - */ -class Baseline { - /** - * Create a Baseline. - * @member {string} sensitivity the sensitivity of the baseline. Possible - * values include: 'Low', 'Medium', 'High' - * @member {array} lowThresholds The low thresholds of the baseline. - * @member {array} highThresholds The high thresholds of the baseline. - */ - constructor() { - } - - /** - * Defines the metadata of Baseline - * - * @returns {object} metadata of Baseline - * - */ - mapper() { - return { - required: false, - serializedName: 'Baseline', - type: { - name: 'Composite', - className: 'Baseline', - modelProperties: { - sensitivity: { - required: true, - serializedName: 'sensitivity', - type: { - name: 'Enum', - allowedValues: [ 'Low', 'Medium', 'High' ] - } - }, - lowThresholds: { - required: true, - serializedName: 'lowThresholds', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - }, - highThresholds: { - required: true, - serializedName: 'highThresholds', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - } - } - } - }; - } -} - -module.exports = Baseline; diff --git a/lib/services/monitor/lib/lib/models/baselineMetadataValue.js b/lib/services/monitor/lib/lib/models/baselineMetadataValue.js deleted file mode 100644 index f0353fa4b3..0000000000 --- a/lib/services/monitor/lib/lib/models/baselineMetadataValue.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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'); - -/** - * Represents a baseline metadata value. - * - */ -class BaselineMetadataValue { - /** - * Create a BaselineMetadataValue. - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ - constructor() { - } - - /** - * Defines the metadata of BaselineMetadataValue - * - * @returns {object} metadata of BaselineMetadataValue - * - */ - mapper() { - return { - required: false, - serializedName: 'BaselineMetadataValue', - type: { - name: 'Composite', - className: 'BaselineMetadataValue', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - value: { - required: false, - serializedName: 'value', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = BaselineMetadataValue; diff --git a/lib/services/monitor/lib/lib/models/baselineResponse.js b/lib/services/monitor/lib/lib/models/baselineResponse.js deleted file mode 100644 index db9e23dd39..0000000000 --- a/lib/services/monitor/lib/lib/models/baselineResponse.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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 response to a baseline query. - * - */ -class BaselineResponse { - /** - * Create a BaselineResponse. - * @member {string} [id] the metric baseline Id. - * @member {string} [type] the resource type of the baseline resource. - * @member {object} [name] the name and the display name of the metric, i.e. - * it is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [timespan] The timespan for which the data was retrieved. - * Its value consists of two datatimes concatenated, separated by '/'. This - * may be adjusted in the future and returned back from what was originally - * requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if - * a metadata request was made. - * @member {string} [aggregation] The aggregation type of the metric. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} [baseline] the baseline values for each sensitivity. - * @member {array} [metadata] the baseline metadata values. - */ - constructor() { - } - - /** - * Defines the metadata of BaselineResponse - * - * @returns {object} metadata of BaselineResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'BaselineResponse', - type: { - name: 'Composite', - className: 'BaselineResponse', - modelProperties: { - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - type: { - required: false, - readOnly: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - timespan: { - required: false, - serializedName: 'properties.timespan', - type: { - name: 'String' - } - }, - interval: { - required: false, - serializedName: 'properties.interval', - type: { - name: 'TimeSpan' - } - }, - aggregation: { - required: false, - serializedName: 'properties.aggregation', - type: { - name: 'String' - } - }, - timestamps: { - required: false, - serializedName: 'properties.timestamps', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DateElementType', - type: { - name: 'DateTime' - } - } - } - }, - baseline: { - required: false, - serializedName: 'properties.baseline', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'BaselineElementType', - type: { - name: 'Composite', - className: 'Baseline' - } - } - } - }, - metadata: { - required: false, - serializedName: 'properties.metadata', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'BaselineMetadataValueElementType', - type: { - name: 'Composite', - className: 'BaselineMetadataValue' - } - } - } - } - } - } - }; - } -} - -module.exports = BaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js b/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js deleted file mode 100644 index 3b8328e966..0000000000 --- a/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 response to a calcualte baseline call. - * - */ -class CalculateBaselineResponse { - /** - * Create a CalculateBaselineResponse. - * @member {string} type the resource type of the baseline resource. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} baseline the baseline values for each sensitivity. - */ - constructor() { - } - - /** - * Defines the metadata of CalculateBaselineResponse - * - * @returns {object} metadata of CalculateBaselineResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'CalculateBaselineResponse', - type: { - name: 'Composite', - className: 'CalculateBaselineResponse', - modelProperties: { - type: { - required: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - timestamps: { - required: false, - serializedName: 'timestamps', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DateElementType', - type: { - name: 'DateTime' - } - } - } - }, - baseline: { - required: true, - serializedName: 'baseline', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'BaselineElementType', - type: { - name: 'Composite', - className: 'Baseline' - } - } - } - } - } - } - }; - } -} - -module.exports = CalculateBaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js deleted file mode 100644 index 00e2c23663..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 diagnostic settings category resource. - * - * @extends models['ProxyOnlyResource'] - */ -class DiagnosticSettingsCategoryResource extends models['ProxyOnlyResource'] { - /** - * Create a DiagnosticSettingsCategoryResource. - * @member {string} [categoryType] The type of the diagnostic settings - * category. Possible values include: 'Metrics', 'Logs' - */ - constructor() { - super(); - } - - /** - * Defines the metadata of DiagnosticSettingsCategoryResource - * - * @returns {object} metadata of DiagnosticSettingsCategoryResource - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsCategoryResource', - type: { - name: 'Composite', - className: 'DiagnosticSettingsCategoryResource', - 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' - } - }, - categoryType: { - required: false, - serializedName: 'properties.categoryType', - type: { - name: 'Enum', - allowedValues: [ 'Metrics', 'Logs' ] - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsCategoryResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js deleted file mode 100644 index 00199aec14..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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'); - -/** - * Represents a collection of diagnostic setting category resources. - * - */ -class DiagnosticSettingsCategoryResourceCollection { - /** - * Create a DiagnosticSettingsCategoryResourceCollection. - * @member {array} [value] The collection of diagnostic settings category - * resources. - */ - constructor() { - } - - /** - * Defines the metadata of DiagnosticSettingsCategoryResourceCollection - * - * @returns {object} metadata of DiagnosticSettingsCategoryResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsCategoryResourceCollection', - type: { - name: 'Composite', - className: 'DiagnosticSettingsCategoryResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DiagnosticSettingsCategoryResourceElementType', - type: { - name: 'Composite', - className: 'DiagnosticSettingsCategoryResource' - } - } - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsCategoryResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js deleted file mode 100644 index b255747c24..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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 diagnostic setting resource. - * - * @extends models['ProxyOnlyResource'] - */ -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} [eventHubAuthorizationRuleId] The resource Id for the - * event hub authorization rule. - * @member {string} [eventHubName] The name of the event hub. If none is - * specified, the default event hub will be selected. - * @member {array} [metrics] the list of metric settings. - * @member {array} [logs] the list of logs settings. - * @member {string} [workspaceId] The workspace ID (resource ID of a Log - * Analytics workspace) for a Log Analytics workspace to which you would like - * to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - */ - constructor() { - super(); - } - - /** - * Defines the metadata of DiagnosticSettingsResource - * - * @returns {object} metadata of DiagnosticSettingsResource - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsResource', - type: { - name: 'Composite', - className: 'DiagnosticSettingsResource', - 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' - } - }, - storageAccountId: { - required: false, - serializedName: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - eventHubAuthorizationRuleId: { - required: false, - serializedName: 'properties.eventHubAuthorizationRuleId', - type: { - name: 'String' - } - }, - eventHubName: { - required: false, - serializedName: 'properties.eventHubName', - type: { - name: 'String' - } - }, - metrics: { - required: false, - serializedName: 'properties.metrics', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricSettingsElementType', - type: { - name: 'Composite', - className: 'MetricSettings' - } - } - } - }, - logs: { - required: false, - serializedName: 'properties.logs', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LogSettingsElementType', - type: { - name: 'Composite', - className: 'LogSettings' - } - } - } - }, - workspaceId: { - required: false, - serializedName: 'properties.workspaceId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js deleted file mode 100644 index 89650e1336..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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'); - -/** - * Represents a collection of alert rule resources. - * - */ -class DiagnosticSettingsResourceCollection { - /** - * Create a DiagnosticSettingsResourceCollection. - * @member {array} [value] The collection of diagnostic settings resources;. - */ - constructor() { - } - - /** - * Defines the metadata of DiagnosticSettingsResourceCollection - * - * @returns {object} metadata of DiagnosticSettingsResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsResourceCollection', - type: { - name: 'Composite', - className: 'DiagnosticSettingsResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DiagnosticSettingsResourceElementType', - type: { - name: 'Composite', - className: 'DiagnosticSettingsResource' - } - } - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/emailNotification.js b/lib/services/monitor/lib/lib/models/emailNotification.js deleted file mode 100644 index c11f1b2d24..0000000000 --- a/lib/services/monitor/lib/lib/models/emailNotification.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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'; - -/** - * Email notification of an autoscale event. - * - */ -class EmailNotification { - /** - * Create a EmailNotification. - * @member {boolean} [sendToSubscriptionAdministrator] a value indicating - * whether to send email to subscription administrator. - * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating - * whether to send email to subscription co-administrators. - * @member {array} [customEmails] the custom e-mails list. This value can be - * null or empty, in which case this attribute will be ignored. - */ - constructor() { - } - - /** - * Defines the metadata of EmailNotification - * - * @returns {object} metadata of EmailNotification - * - */ - mapper() { - return { - required: false, - serializedName: 'EmailNotification', - type: { - name: 'Composite', - className: 'EmailNotification', - modelProperties: { - sendToSubscriptionAdministrator: { - required: false, - serializedName: 'sendToSubscriptionAdministrator', - type: { - name: 'Boolean' - } - }, - sendToSubscriptionCoAdministrators: { - required: false, - serializedName: 'sendToSubscriptionCoAdministrators', - type: { - name: 'Boolean' - } - }, - customEmails: { - required: false, - serializedName: 'customEmails', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = EmailNotification; diff --git a/lib/services/monitor/lib/lib/models/emailReceiver.js b/lib/services/monitor/lib/lib/models/emailReceiver.js deleted file mode 100644 index 508eac1ad4..0000000000 --- a/lib/services/monitor/lib/lib/models/emailReceiver.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 email receiver. - * - */ -class EmailReceiver { - /** - * Create a EmailReceiver. - * @member {string} name The name of the email receiver. Names must be unique - * across all receivers within an action group. - * @member {string} emailAddress The email address of this receiver. - * @member {string} [status] The receiver status of the e-mail. Possible - * values include: 'NotSpecified', 'Enabled', 'Disabled' - */ - constructor() { - } - - /** - * Defines the metadata of EmailReceiver - * - * @returns {object} metadata of EmailReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'EmailReceiver', - type: { - name: 'Composite', - className: 'EmailReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - emailAddress: { - required: true, - serializedName: 'emailAddress', - type: { - name: 'String' - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] - } - } - } - } - }; - } -} - -module.exports = EmailReceiver; diff --git a/lib/services/monitor/lib/lib/models/enableRequest.js b/lib/services/monitor/lib/lib/models/enableRequest.js deleted file mode 100644 index 886d80bc33..0000000000 --- a/lib/services/monitor/lib/lib/models/enableRequest.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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'; - -/** - * Describes a receiver that should be resubscribed. - * - */ -class EnableRequest { - /** - * Create a EnableRequest. - * @member {string} receiverName The name of the receiver to resubscribe. - */ - constructor() { - } - - /** - * Defines the metadata of EnableRequest - * - * @returns {object} metadata of EnableRequest - * - */ - mapper() { - return { - required: false, - serializedName: 'EnableRequest', - type: { - name: 'Composite', - className: 'EnableRequest', - modelProperties: { - receiverName: { - required: true, - serializedName: 'receiverName', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EnableRequest; diff --git a/lib/services/monitor/lib/lib/models/errorResponse.js b/lib/services/monitor/lib/lib/models/errorResponse.js deleted file mode 100644 index f952d62061..0000000000 --- a/lib/services/monitor/lib/lib/models/errorResponse.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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'; - -/** - * Describes the format of Error response. - * - */ -class ErrorResponse { - /** - * Create a ErrorResponse. - * @member {string} [code] Error code - * @member {string} [message] Error message indicating why the operation - * failed. - */ - constructor() { - } - - /** - * Defines the metadata of ErrorResponse - * - * @returns {object} metadata of ErrorResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'ErrorResponse', - type: { - name: 'Composite', - className: 'ErrorResponse', - modelProperties: { - code: { - required: false, - serializedName: 'code', - type: { - name: 'String' - } - }, - message: { - required: false, - serializedName: 'message', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ErrorResponse; diff --git a/lib/services/monitor/lib/lib/models/eventCategoryCollection.js b/lib/services/monitor/lib/lib/models/eventCategoryCollection.js deleted file mode 100644 index 5a8180acf9..0000000000 --- a/lib/services/monitor/lib/lib/models/eventCategoryCollection.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 collection of event categories. Currently possible values are: - * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. - */ -class EventCategoryCollection extends Array { - /** - * Create a EventCategoryCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of EventCategoryCollection - * - * @returns {object} metadata of EventCategoryCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'EventCategoryCollection', - type: { - name: 'Composite', - className: 'EventCategoryCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LocalizableStringElementType', - type: { - name: 'Composite', - className: 'LocalizableString' - } - } - } - } - } - } - }; - } -} - -module.exports = EventCategoryCollection; diff --git a/lib/services/monitor/lib/lib/models/eventData.js b/lib/services/monitor/lib/lib/models/eventData.js deleted file mode 100644 index 4e8b1c3046..0000000000 --- a/lib/services/monitor/lib/lib/models/eventData.js +++ /dev/null @@ -1,342 +0,0 @@ -/* - * 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 Azure event log entries are of type EventData - * - */ -class EventData { - /** - * Create a EventData. - * @member {object} [authorization] - * @member {string} [authorization.action] the permissible actions. For - * instance: microsoft.support/supporttickets/write - * @member {string} [authorization.role] the role of the user. For instance: - * Subscription Admin - * @member {string} [authorization.scope] the scope. - * @member {object} [claims] key value pairs to identify ARM permissions. - * @member {string} [caller] the email address of the user who has performed - * the operation, the UPN claim or SPN claim based on availability. - * @member {string} [description] the description of the event. - * @member {string} [id] the Id of this event as required by ARM for RBAC. It - * contains the EventDataID and a timestamp information. - * @member {string} [eventDataId] the event data Id. This is a unique - * identifier for an event. - * @member {string} [correlationId] the correlation Id, usually a GUID in the - * string format. The correlation Id is shared among the events that belong - * to the same uber operation. - * @member {object} [eventName] the event name. This value should not be - * confused with OperationName. For practical purposes, OperationName might - * be more appealing to end users. - * @member {string} [eventName.value] the invariant value. - * @member {string} [eventName.localizedValue] the locale specific value. - * @member {object} [category] the event category. - * @member {string} [category.value] the invariant value. - * @member {string} [category.localizedValue] the locale specific value. - * @member {object} [httpRequest] the HTTP request info. Usually includes the - * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated - * the event) and 'method' (HTTP method e.g. PUT). - * @member {string} [httpRequest.clientRequestId] the client request id. - * @member {string} [httpRequest.clientIpAddress] the client Ip Address - * @member {string} [httpRequest.method] the Http request method. - * @member {string} [httpRequest.uri] the Uri. - * @member {string} [level] the event level. Possible values include: - * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - * @member {string} [resourceGroupName] the resource group name of the - * impacted resource. - * @member {object} [resourceProviderName] the resource provider name of the - * impacted resource. - * @member {string} [resourceProviderName.value] the invariant value. - * @member {string} [resourceProviderName.localizedValue] the locale specific - * value. - * @member {string} [resourceId] the resource uri that uniquely identifies - * the resource that caused this event. - * @member {object} [resourceType] the resource type - * @member {string} [resourceType.value] the invariant value. - * @member {string} [resourceType.localizedValue] the locale specific value. - * @member {string} [operationId] It is usually a GUID shared among the - * events corresponding to single operation. This value should not be - * confused with EventName. - * @member {object} [operationName] the operation name. - * @member {string} [operationName.value] the invariant value. - * @member {string} [operationName.localizedValue] the locale specific value. - * @member {object} [properties] the set of pairs (usually a - * Dictionary) that includes details about the event. - * @member {object} [status] a string describing the status of the operation. - * Some typical values are: Started, In progress, Succeeded, Failed, - * Resolved. - * @member {string} [status.value] the invariant value. - * @member {string} [status.localizedValue] the locale specific value. - * @member {object} [subStatus] the event sub status. Most of the time, when - * included, this captures the HTTP status code of the REST call. Common - * values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), - * Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad - * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), - * Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: - * 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP - * Status Code: 504) - * @member {string} [subStatus.value] the invariant value. - * @member {string} [subStatus.localizedValue] the locale specific value. - * @member {date} [eventTimestamp] the timestamp of when the event was - * generated by the Azure service processing the request corresponding the - * event. It in ISO 8601 format. - * @member {date} [submissionTimestamp] the timestamp of when the event - * became available for querying via this API. It is in ISO 8601 format. This - * value should not be confused eventTimestamp. As there might be a delay - * between the occurrence time of the event, and the time that the event is - * submitted to the Azure logging infrastructure. - * @member {string} [subscriptionId] the Azure subscription Id usually a - * GUID. - * @member {string} [tenantId] the Azure tenant Id - */ - constructor() { - } - - /** - * Defines the metadata of EventData - * - * @returns {object} metadata of EventData - * - */ - mapper() { - return { - required: false, - serializedName: 'EventData', - type: { - name: 'Composite', - className: 'EventData', - modelProperties: { - authorization: { - required: false, - readOnly: true, - serializedName: 'authorization', - type: { - name: 'Composite', - className: 'SenderAuthorization' - } - }, - claims: { - required: false, - readOnly: true, - serializedName: 'claims', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - caller: { - required: false, - readOnly: true, - serializedName: 'caller', - type: { - name: 'String' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - eventDataId: { - required: false, - readOnly: true, - serializedName: 'eventDataId', - type: { - name: 'String' - } - }, - correlationId: { - required: false, - readOnly: true, - serializedName: 'correlationId', - type: { - name: 'String' - } - }, - eventName: { - required: false, - readOnly: true, - serializedName: 'eventName', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - category: { - required: false, - readOnly: true, - serializedName: 'category', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - httpRequest: { - required: false, - readOnly: true, - serializedName: 'httpRequest', - type: { - name: 'Composite', - className: 'HttpRequestInfo' - } - }, - level: { - required: false, - readOnly: true, - serializedName: 'level', - type: { - name: 'Enum', - allowedValues: [ 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' ] - } - }, - resourceGroupName: { - required: false, - readOnly: true, - serializedName: 'resourceGroupName', - type: { - name: 'String' - } - }, - resourceProviderName: { - required: false, - readOnly: true, - serializedName: 'resourceProviderName', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - resourceId: { - required: false, - readOnly: true, - serializedName: 'resourceId', - type: { - name: 'String' - } - }, - resourceType: { - required: false, - readOnly: true, - serializedName: 'resourceType', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - operationId: { - required: false, - readOnly: true, - serializedName: 'operationId', - type: { - name: 'String' - } - }, - operationName: { - required: false, - readOnly: true, - serializedName: 'operationName', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - properties: { - required: false, - readOnly: true, - serializedName: 'properties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - subStatus: { - required: false, - readOnly: true, - serializedName: 'subStatus', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - eventTimestamp: { - required: false, - readOnly: true, - serializedName: 'eventTimestamp', - type: { - name: 'DateTime' - } - }, - submissionTimestamp: { - required: false, - readOnly: true, - serializedName: 'submissionTimestamp', - type: { - name: 'DateTime' - } - }, - subscriptionId: { - required: false, - readOnly: true, - serializedName: 'subscriptionId', - type: { - name: 'String' - } - }, - tenantId: { - required: false, - readOnly: true, - serializedName: 'tenantId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EventData; diff --git a/lib/services/monitor/lib/lib/models/eventDataCollection.js b/lib/services/monitor/lib/lib/models/eventDataCollection.js deleted file mode 100644 index 0fe4c985c9..0000000000 --- a/lib/services/monitor/lib/lib/models/eventDataCollection.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 collection of events. - */ -class EventDataCollection extends Array { - /** - * Create a EventDataCollection. - * @member {string} [nextLink] Provides the link to retrieve the next set of - * events. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of EventDataCollection - * - * @returns {object} metadata of EventDataCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'EventDataCollection', - type: { - name: 'Composite', - className: 'EventDataCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'EventDataElementType', - type: { - name: 'Composite', - className: 'EventData' - } - } - } - }, - nextLink: { - required: false, - serializedName: 'nextLink', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EventDataCollection; diff --git a/lib/services/monitor/lib/lib/models/httpRequestInfo.js b/lib/services/monitor/lib/lib/models/httpRequestInfo.js deleted file mode 100644 index 309dc12fd0..0000000000 --- a/lib/services/monitor/lib/lib/models/httpRequestInfo.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 Http request info. - * - */ -class HttpRequestInfo { - /** - * Create a HttpRequestInfo. - * @member {string} [clientRequestId] the client request id. - * @member {string} [clientIpAddress] the client Ip Address - * @member {string} [method] the Http request method. - * @member {string} [uri] the Uri. - */ - constructor() { - } - - /** - * Defines the metadata of HttpRequestInfo - * - * @returns {object} metadata of HttpRequestInfo - * - */ - mapper() { - return { - required: false, - serializedName: 'HttpRequestInfo', - type: { - name: 'Composite', - className: 'HttpRequestInfo', - modelProperties: { - clientRequestId: { - required: false, - serializedName: 'clientRequestId', - type: { - name: 'String' - } - }, - clientIpAddress: { - required: false, - serializedName: 'clientIpAddress', - type: { - name: 'String' - } - }, - method: { - required: false, - serializedName: 'method', - type: { - name: 'String' - } - }, - uri: { - required: false, - serializedName: 'uri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = HttpRequestInfo; diff --git a/lib/services/monitor/lib/lib/models/incident.js b/lib/services/monitor/lib/lib/models/incident.js deleted file mode 100644 index a591fb7efa..0000000000 --- a/lib/services/monitor/lib/lib/models/incident.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 incident indicates the activation status of an alert rule. - * - */ -class Incident { - /** - * Create a Incident. - * @member {string} [name] Incident name. - * @member {string} [ruleName] Rule name that is associated with the - * incident. - * @member {boolean} [isActive] A boolean to indicate whether the incident is - * active or resolved. - * @member {date} [activatedTime] The time at which the incident was - * activated in ISO8601 format. - * @member {date} [resolvedTime] The time at which the incident was resolved - * in ISO8601 format. If null, it means the incident is still active. - */ - constructor() { - } - - /** - * Defines the metadata of Incident - * - * @returns {object} metadata of Incident - * - */ - mapper() { - return { - required: false, - serializedName: 'Incident', - type: { - name: 'Composite', - className: 'Incident', - modelProperties: { - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - ruleName: { - required: false, - readOnly: true, - serializedName: 'ruleName', - type: { - name: 'String' - } - }, - isActive: { - required: false, - readOnly: true, - serializedName: 'isActive', - type: { - name: 'Boolean' - } - }, - activatedTime: { - required: false, - readOnly: true, - serializedName: 'activatedTime', - type: { - name: 'DateTime' - } - }, - resolvedTime: { - required: false, - readOnly: true, - serializedName: 'resolvedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = Incident; diff --git a/lib/services/monitor/lib/lib/models/incidentListResult.js b/lib/services/monitor/lib/lib/models/incidentListResult.js deleted file mode 100644 index 968388fb50..0000000000 --- a/lib/services/monitor/lib/lib/models/incidentListResult.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 List incidents operation response. - */ -class IncidentListResult extends Array { - /** - * Create a IncidentListResult. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of IncidentListResult - * - * @returns {object} metadata of IncidentListResult - * - */ - mapper() { - return { - required: false, - serializedName: 'IncidentListResult', - type: { - name: 'Composite', - className: 'IncidentListResult', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'IncidentElementType', - type: { - name: 'Composite', - className: 'Incident' - } - } - } - } - } - } - }; - } -} - -module.exports = IncidentListResult; diff --git a/lib/services/monitor/lib/lib/models/index.d.ts b/lib/services/monitor/lib/lib/models/index.d.ts deleted file mode 100644 index 44807752fe..0000000000 --- a/lib/services/monitor/lib/lib/models/index.d.ts +++ /dev/null @@ -1,2298 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { BaseResource } from 'ms-rest-azure'; -import { CloudError } from 'ms-rest-azure'; -import * as moment from 'moment'; - -export { BaseResource } from 'ms-rest-azure'; -export { CloudError } from 'ms-rest-azure'; - - -/** - * @class - * Initializes a new instance of the Resource class. - * @constructor - * An azure resource object - * - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - * @member {string} location Resource location - * @member {object} [tags] Resource tags - */ -export interface Resource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; - location: string; - tags?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the ScaleCapacity class. - * @constructor - * The number of instances that can be used during this profile. - * - * @member {string} minimum the minimum number of instances for the resource. - * @member {string} maximum the maximum number of instances for the resource. - * The actual maximum number of instances is limited by the cores that are - * available in the subscription. - * @member {string} default the number of instances that will be set if metrics - * are not available for evaluation. The default is only used if the current - * instance count is lower than the default. - */ -export interface ScaleCapacity { - minimum: string; - maximum: string; - default: string; -} - -/** - * @class - * Initializes a new instance of the MetricTrigger class. - * @constructor - * The trigger that results in a scaling action. - * - * @member {string} metricName the name of the metric that defines what the - * rule monitors. - * @member {string} metricResourceUri the resource identifier of the resource - * the rule monitors. - * @member {moment.duration} timeGrain the granularity of metrics the rule - * monitors. Must be one of the predefined values returned from metric - * definitions for the metric. Must be between 12 hours and 1 minute. - * @member {string} statistic the metric statistic type. How the metrics from - * multiple instances are combined. Possible values include: 'Average', 'Min', - * 'Max', 'Sum' - * @member {moment.duration} timeWindow the range of time in which instance - * data is collected. This value must be greater than the delay in metric - * collection, which can vary from resource-to-resource. Must be between 12 - * hours and 5 minutes. - * @member {string} timeAggregation time aggregation type. How the data that is - * collected should be combined over time. The default value is Average. - * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' - * @member {string} operator the operator that is used to compare the metric - * data and the threshold. Possible values include: 'Equals', 'NotEquals', - * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold of the metric that triggers the - * scale action. - */ -export interface MetricTrigger { - metricName: string; - metricResourceUri: string; - timeGrain: moment.Duration; - statistic: string; - timeWindow: moment.Duration; - timeAggregation: string; - operator: string; - threshold: number; -} - -/** - * @class - * Initializes a new instance of the ScaleAction class. - * @constructor - * The parameters for the scaling action. - * - * @member {string} direction the scale direction. Whether the scaling action - * increases or decreases the number of instances. Possible values include: - * 'None', 'Increase', 'Decrease' - * @member {string} type the type of action that should occur when the scale - * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', - * 'ExactCount' - * @member {string} [value] the number of instances that are involved in the - * scaling action. This value must be 1 or greater. The default value is 1. - * Default value: '1' . - * @member {moment.duration} cooldown the amount of time to wait since the last - * scaling action before this action occurs. It must be between 1 week and 1 - * minute in ISO 8601 format. - */ -export interface ScaleAction { - direction: string; - type: string; - value?: string; - cooldown: moment.Duration; -} - -/** - * @class - * Initializes a new instance of the ScaleRule class. - * @constructor - * A rule that provide the triggers and parameters for the scaling action. - * - * @member {object} metricTrigger the trigger that results in a scaling action. - * @member {string} [metricTrigger.metricName] the name of the metric that - * defines what the rule monitors. - * @member {string} [metricTrigger.metricResourceUri] the resource identifier - * of the resource the rule monitors. - * @member {moment.duration} [metricTrigger.timeGrain] the granularity of - * metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [metricTrigger.statistic] the metric statistic type. How - * the metrics from multiple instances are combined. Possible values include: - * 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [metricTrigger.timeWindow] the range of time in - * which instance data is collected. This value must be greater than the delay - * in metric collection, which can vary from resource-to-resource. Must be - * between 12 hours and 5 minutes. - * @member {string} [metricTrigger.timeAggregation] time aggregation type. How - * the data that is collected should be combined over time. The default value - * is Average. Possible values include: 'Average', 'Minimum', 'Maximum', - * 'Total', 'Count' - * @member {string} [metricTrigger.operator] the operator that is used to - * compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [metricTrigger.threshold] the threshold of the metric that - * triggers the scale action. - * @member {object} scaleAction the parameters for the scaling action. - * @member {string} [scaleAction.direction] the scale direction. Whether the - * scaling action increases or decreases the number of instances. Possible - * values include: 'None', 'Increase', 'Decrease' - * @member {string} [scaleAction.type] the type of action that should occur - * when the scale rule fires. Possible values include: 'ChangeCount', - * 'PercentChangeCount', 'ExactCount' - * @member {string} [scaleAction.value] the number of instances that are - * involved in the scaling action. This value must be 1 or greater. The default - * value is 1. - * @member {moment.duration} [scaleAction.cooldown] the amount of time to wait - * since the last scaling action before this action occurs. It must be between - * 1 week and 1 minute in ISO 8601 format. - */ -export interface ScaleRule { - metricTrigger: MetricTrigger; - scaleAction: ScaleAction; -} - -/** - * @class - * Initializes a new instance of the TimeWindow class. - * @constructor - * A specific date-time for the profile. - * - * @member {string} [timeZone] the timezone of the start and end times for the - * profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time - * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central - * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern - * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic - * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, - * Pacific SA Standard Time, Newfoundland Standard Time, E. South America - * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, - * Central European Standard Time, W. Central Africa Standard Time, Namibia - * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, - * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic - * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard - * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, - * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, - * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, - * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, - * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central - * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {date} start the start time for the profile in ISO 8601 format. - * @member {date} end the end time for the profile in ISO 8601 format. - */ -export interface TimeWindow { - timeZone?: string; - start: Date; - end: Date; -} - -/** - * @class - * Initializes a new instance of the RecurrentSchedule class. - * @constructor - * The scheduling constraints for when the profile begins. - * - * @member {string} timeZone the timezone for the hours of the profile. Some - * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian - * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), - * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time - * (Mexico), Mountain Standard Time, Central America Standard Time, Central - * Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, - * SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, - * Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, - * Central Brazilian Standard Time, SA Western Standard Time, Pacific SA - * Standard Time, Newfoundland Standard Time, E. South America Standard Time, - * Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, - * Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard - * Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, - * UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, - * Central Europe Standard Time, Romance Standard Time, Central European - * Standard Time, W. Central Africa Standard Time, Namibia Standard Time, - * Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt - * Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa - * Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard - * Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, - * Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa - * Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan - * Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian - * Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia - * Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India - * Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia - * Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} days the collection of days that the profile takes effect - * on. Possible values are Sunday through Saturday. - * @member {array} hours A collection of hours that the profile takes effect - * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not - * supported). - * @member {array} minutes A collection of minutes at which the profile takes - * effect at. - */ -export interface RecurrentSchedule { - timeZone: string; - days: string[]; - hours: number[]; - minutes: number[]; -} - -/** - * @class - * Initializes a new instance of the Recurrence class. - * @constructor - * 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 - * profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time - * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central - * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern - * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic - * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, - * Pacific SA Standard Time, Newfoundland Standard Time, E. South America - * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, - * Central European Standard Time, W. Central Africa Standard Time, Namibia - * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, - * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic - * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard - * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, - * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, - * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, - * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, - * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central - * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [schedule.days] the collection of days that the profile - * takes effect on. Possible values are Sunday through Saturday. - * @member {array} [schedule.hours] A collection of hours that the profile - * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - * times are not supported). - * @member {array} [schedule.minutes] A collection of minutes at which the - * profile takes effect at. - */ -export interface Recurrence { - frequency: string; - schedule: RecurrentSchedule; -} - -/** - * @class - * Initializes a new instance of the AutoscaleProfile class. - * @constructor - * Autoscale profile. - * - * @member {string} name the name of the profile. - * @member {object} capacity the number of instances that can be used during - * this profile. - * @member {string} [capacity.minimum] the minimum number of instances for the - * resource. - * @member {string} [capacity.maximum] the maximum number of instances for the - * resource. The actual maximum number of instances is limited by the cores - * that are available in the subscription. - * @member {string} [capacity.default] the number of instances that will be set - * if metrics are not available for evaluation. The default is only used if the - * current instance count is lower than the default. - * @member {array} rules the collection of rules that provide the triggers and - * parameters for the scaling action. A maximum of 10 rules can be specified. - * @member {object} [fixedDate] the specific date-time for the profile. This - * element is not used if the Recurrence element is used. - * @member {string} [fixedDate.timeZone] the timezone of the start and end - * times for the profile. Some examples of valid timezones are: Dateline - * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard - * Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central - * America Standard Time, Central Standard Time, Central Standard Time - * (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern - * Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay - * Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA - * Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, - * E. South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya - * Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard - * Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, - * Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, - * Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, - * Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard - * Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, - * Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, - * N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, - * North Asia Standard Time, China Standard Time, North Asia East Standard - * Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard - * Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, - * Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard - * Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific - * Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok - * Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia - * Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, - * Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line - * Islands Standard Time - * @member {date} [fixedDate.start] the start time for the profile in ISO 8601 - * format. - * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 - * 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 - * of the profile. Some examples of valid timezones are: Dateline Standard - * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - * Mountain Standard Time (Mexico), Mountain Standard Time, Central America - * Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada - * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US - * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - * Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard - * Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America - * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, - * Central European Standard Time, W. Central Africa Standard Time, Namibia - * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, - * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic - * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard - * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, - * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, - * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, - * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, - * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central - * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [recurrence.schedule.days] the collection of days that the - * profile takes effect on. Possible values are Sunday through Saturday. - * @member {array} [recurrence.schedule.hours] A collection of hours that the - * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock - * (AM/PM times are not supported). - * @member {array} [recurrence.schedule.minutes] A collection of minutes at - * which the profile takes effect at. - */ -export interface AutoscaleProfile { - name: string; - capacity: ScaleCapacity; - rules: ScaleRule[]; - fixedDate?: TimeWindow; - recurrence?: Recurrence; -} - -/** - * @class - * Initializes a new instance of the EmailNotification class. - * @constructor - * Email notification of an autoscale event. - * - * @member {boolean} [sendToSubscriptionAdministrator] a value indicating - * whether to send email to subscription administrator. - * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating - * whether to send email to subscription co-administrators. - * @member {array} [customEmails] the custom e-mails list. This value can be - * null or empty, in which case this attribute will be ignored. - */ -export interface EmailNotification { - sendToSubscriptionAdministrator?: boolean; - sendToSubscriptionCoAdministrators?: boolean; - customEmails?: string[]; -} - -/** - * @class - * Initializes a new instance of the WebhookNotification class. - * @constructor - * Webhook notification of an autoscale event. - * - * @member {string} [serviceUri] the service address to receive the - * notification. - * @member {object} [properties] a property bag of settings. This value can be - * empty. - */ -export interface WebhookNotification { - serviceUri?: string; - properties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the AutoscaleNotification class. - * @constructor - * Autoscale notification. - * - * @member {object} [email] the email notification. - * @member {boolean} [email.sendToSubscriptionAdministrator] a value indicating - * whether to send email to subscription administrator. - * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value - * indicating whether to send email to subscription co-administrators. - * @member {array} [email.customEmails] the custom e-mails list. This value can - * be null or empty, in which case this attribute will be ignored. - * @member {array} [webhooks] the collection of webhook notifications. - */ -export interface AutoscaleNotification { - email?: EmailNotification; - webhooks?: WebhookNotification[]; -} - -/** - * @class - * Initializes a new instance of the AutoscaleSettingResource class. - * @constructor - * The autoscale setting resource. - * - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [autoscaleSettingResourceName] the name of the autoscale - * setting. - * @member {string} [targetResourceUri] the resource identifier of the resource - * that the autoscale setting should be added to. - */ -export interface AutoscaleSettingResource extends Resource { - profiles: AutoscaleProfile[]; - notifications?: AutoscaleNotification[]; - enabled?: boolean; - autoscaleSettingResourceName?: string; - targetResourceUri?: string; -} - -/** - * @class - * Initializes a new instance of the AutoscaleSettingResourcePatch class. - * @constructor - * The autoscale setting object for patch operations. - * - * @member {object} [tags] Resource tags - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [name] the name of the autoscale setting. - * @member {string} [targetResourceUri] the resource identifier of the resource - * that the autoscale setting should be added to. - */ -export interface AutoscaleSettingResourcePatch { - tags?: { [propertyName: string]: string }; - profiles: AutoscaleProfile[]; - notifications?: AutoscaleNotification[]; - enabled?: boolean; - name?: string; - targetResourceUri?: string; -} - -/** - * @class - * Initializes a new instance of the ErrorResponse class. - * @constructor - * Describes the format of Error response. - * - * @member {string} [code] Error code - * @member {string} [message] Error message indicating why the operation - * failed. - */ -export interface ErrorResponse { - code?: string; - message?: string; -} - -/** - * @class - * Initializes a new instance of the OperationDisplay class. - * @constructor - * Display metadata associated with the operation. - * - * @member {string} [provider] Service provider: Microsoft.Insights - * @member {string} [resource] Resource on which the operation is performed: - * AlertRules, Autoscale, etc. - * @member {string} [operation] Operation type: Read, write, delete, etc. - */ -export interface OperationDisplay { - provider?: string; - resource?: string; - operation?: string; -} - -/** - * @class - * Initializes a new instance of the Operation class. - * @constructor - * Microsoft Insights API operation definition. - * - * @member {string} [name] Operation name: {provider}/{resource}/{operation} - * @member {object} [display] Display metadata associated with the operation. - * @member {string} [display.provider] Service provider: Microsoft.Insights - * @member {string} [display.resource] Resource on which the operation is - * performed: AlertRules, Autoscale, etc. - * @member {string} [display.operation] Operation type: Read, write, delete, - * etc. - */ -export interface Operation { - name?: string; - display?: OperationDisplay; -} - -/** - * @class - * Initializes a new instance of the OperationListResult class. - * @constructor - * Result of the request to list Microsoft.Insights operations. It contains a - * list of operations and a URL link to get the next set of results. - * - * @member {array} [value] List of operations supported by the - * Microsoft.Insights provider. - * @member {string} [nextLink] URL to get the next set of operation list - * results if there are any. - */ -export interface OperationListResult { - value?: Operation[]; - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the Incident class. - * @constructor - * An alert incident indicates the activation status of an alert rule. - * - * @member {string} [name] Incident name. - * @member {string} [ruleName] Rule name that is associated with the incident. - * @member {boolean} [isActive] A boolean to indicate whether the incident is - * active or resolved. - * @member {date} [activatedTime] The time at which the incident was activated - * in ISO8601 format. - * @member {date} [resolvedTime] The time at which the incident was resolved in - * ISO8601 format. If null, it means the incident is still active. - */ -export interface Incident { - readonly name?: string; - readonly ruleName?: string; - readonly isActive?: boolean; - readonly activatedTime?: Date; - readonly resolvedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the RuleDataSource class. - * @constructor - * The resource from which the rule collects its data. - * - * @member {string} [resourceUri] the resource identifier of the resource the - * rule monitors. **NOTE**: this property cannot be updated for an existing - * rule. - * @member {string} odatatype Polymorphic Discriminator - */ -export interface RuleDataSource { - resourceUri?: string; - odatatype: string; -} - -/** - * @class - * Initializes a new instance of the RuleCondition class. - * @constructor - * The condition that results in the alert rule being activated. - * - * @member {object} [dataSource] the resource from which the rule collects its - * data. For this type dataSource will always be of type RuleMetricDataSource. - * @member {string} [dataSource.resourceUri] the resource identifier of the - * resource the rule monitors. **NOTE**: this property cannot be updated for an - * existing rule. - * @member {string} [dataSource.odatatype] Polymorphic Discriminator - * @member {string} odatatype Polymorphic Discriminator - */ -export interface RuleCondition { - dataSource?: RuleDataSource; - odatatype: string; -} - -/** - * @class - * Initializes a new instance of the RuleMetricDataSource class. - * @constructor - * A rule metric data source. The discriminator value is always - * RuleMetricDataSource in this case. - * - * @member {string} [metricName] the name of the metric that defines what the - * rule monitors. - */ -export interface RuleMetricDataSource extends RuleDataSource { - metricName?: string; -} - -/** - * @class - * Initializes a new instance of the RuleManagementEventClaimsDataSource class. - * @constructor - * The claims for a rule management event data source. - * - * @member {string} [emailAddress] the email address. - */ -export interface RuleManagementEventClaimsDataSource { - emailAddress?: string; -} - -/** - * @class - * Initializes a new instance of the RuleManagementEventDataSource class. - * @constructor - * A rule management event data source. The discriminator fields is always - * RuleManagementEventDataSource in this case. - * - * @member {string} [eventName] the event name. - * @member {string} [eventSource] the event source. - * @member {string} [level] the level. - * @member {string} [operationName] The name of the operation that should be - * checked for. If no name is provided, any operation will match. - * @member {string} [resourceGroupName] the resource group name. - * @member {string} [resourceProviderName] the resource provider name. - * @member {string} [status] The status of the operation that should be checked - * for. If no status is provided, any status will match. - * @member {string} [subStatus] the substatus. - * @member {object} [claims] the claims. - * @member {string} [claims.emailAddress] the email address. - */ -export interface RuleManagementEventDataSource extends RuleDataSource { - eventName?: string; - eventSource?: string; - level?: string; - operationName?: string; - resourceGroupName?: string; - resourceProviderName?: string; - status?: string; - subStatus?: string; - claims?: RuleManagementEventClaimsDataSource; -} - -/** - * @class - * Initializes a new instance of the ThresholdRuleCondition class. - * @constructor - * A rule condition based on a metric crossing a threshold. - * - * @member {string} operator the operator used to compare the data and the - * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', - * 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {string} [timeAggregation] the time aggregation operator. How the - * data that are collected should be combined over time. The default value is - * the PrimaryAggregationType of the Metric. Possible values include: - * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' - */ -export interface ThresholdRuleCondition extends RuleCondition { - operator: string; - threshold: number; - windowSize?: moment.Duration; - timeAggregation?: string; -} - -/** - * @class - * Initializes a new instance of the LocationThresholdRuleCondition class. - * @constructor - * A rule condition based on a certain number of locations failing. - * - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {number} failedLocationCount the number of locations that must fail - * to activate the alert. - */ -export interface LocationThresholdRuleCondition extends RuleCondition { - windowSize?: moment.Duration; - failedLocationCount: number; -} - -/** - * @class - * Initializes a new instance of the ManagementEventAggregationCondition class. - * @constructor - * How the data that is collected should be combined over time. - * - * @member {string} [operator] the condition operator. Possible values include: - * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - * @member {number} [threshold] The threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - */ -export interface ManagementEventAggregationCondition { - operator?: string; - threshold?: number; - windowSize?: moment.Duration; -} - -/** - * @class - * Initializes a new instance of the ManagementEventRuleCondition class. - * @constructor - * A management event rule condition. - * - * @member {object} [aggregation] How the data that is collected should be - * combined over time and when the alert is activated. Note that for management - * event alerts aggregation is optional – if it is not provided then any event - * will cause the alert to activate. - * @member {string} [aggregation.operator] the condition operator. Possible - * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [aggregation.threshold] The threshold value that activates - * the alert. - * @member {moment.duration} [aggregation.windowSize] the period of time (in - * ISO 8601 duration format) that is used to monitor alert activity based on - * the threshold. If specified then it must be between 5 minutes and 1 day. - */ -export interface ManagementEventRuleCondition extends RuleCondition { - aggregation?: ManagementEventAggregationCondition; -} - -/** - * @class - * Initializes a new instance of the RuleAction class. - * @constructor - * The action that is performed when the alert rule becomes active, and when an - * alert condition is resolved. - * - * @member {string} odatatype Polymorphic Discriminator - */ -export interface RuleAction { - odatatype: string; -} - -/** - * @class - * Initializes a new instance of the RuleEmailAction class. - * @constructor - * Specifies the action to send email when the rule condition is evaluated. The - * discriminator is always RuleEmailAction in this case. - * - * @member {boolean} [sendToServiceOwners] Whether the administrators (service - * and co-administrators) of the service should be notified when the alert is - * activated. - * @member {array} [customEmails] the list of administrator's custom email - * addresses to notify of the activation of the alert. - */ -export interface RuleEmailAction extends RuleAction { - sendToServiceOwners?: boolean; - customEmails?: string[]; -} - -/** - * @class - * Initializes a new instance of the RuleWebhookAction class. - * @constructor - * Specifies the action to post to service when the rule condition is - * evaluated. The discriminator is always RuleWebhookAction in this case. - * - * @member {string} [serviceUri] the service uri to Post the notification when - * the alert activates or resolves. - * @member {object} [properties] the dictionary of custom properties to include - * with the post operation. These data are appended to the webhook payload. - */ -export interface RuleWebhookAction extends RuleAction { - serviceUri?: string; - properties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the AlertRuleResource class. - * @constructor - * The alert rule resource. - * - * @member {string} alertRuleResourceName the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource identifier - * of the resource the rule monitors. **NOTE**: this property cannot be updated - * for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface AlertRuleResource extends Resource { - alertRuleResourceName: string; - description?: string; - isEnabled: boolean; - condition: RuleCondition; - actions?: RuleAction[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the AlertRuleResourcePatch class. - * @constructor - * The alert rule object for patch operations. - * - * @member {object} [tags] Resource tags - * @member {string} name the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource identifier - * of the resource the rule monitors. **NOTE**: this property cannot be updated - * for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface AlertRuleResourcePatch { - tags?: { [propertyName: string]: string }; - name: string; - description?: string; - isEnabled: boolean; - condition: RuleCondition; - actions?: RuleAction[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the RetentionPolicy class. - * @constructor - * Specifies the retention policy for the log. - * - * @member {boolean} enabled a value indicating whether the retention policy is - * enabled. - * @member {number} days the number of days for the retention in days. A value - * of 0 will retain the events indefinitely. - */ -export interface RetentionPolicy { - enabled: boolean; - days: number; -} - -/** - * @class - * Initializes a new instance of the LogProfileResource class. - * @constructor - * The log profile resource. - * - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories are - * created as is convenient to the user. Some values are: 'Write', 'Delete', - * and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in the - * log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface LogProfileResource extends Resource { - storageAccountId?: string; - serviceBusRuleId?: string; - locations: string[]; - categories: string[]; - retentionPolicy: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the LogProfileResourcePatch class. - * @constructor - * The log profile resource for patch operations. - * - * @member {object} [tags] Resource tags - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories are - * created as is convenient to the user. Some values are: 'Write', 'Delete', - * and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in the - * log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface LogProfileResourcePatch { - tags?: { [propertyName: string]: string }; - storageAccountId?: string; - serviceBusRuleId?: string; - locations: string[]; - categories: string[]; - retentionPolicy: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the ProxyOnlyResource class. - * @constructor - * A proxy only azure resource object - * - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - */ -export interface ProxyOnlyResource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; -} - -/** - * @class - * Initializes a new instance of the MetricSettings class. - * @constructor - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular metric. - * - * @member {moment.duration} [timeGrain] the timegrain of the metric in ISO8601 - * format. - * @member {string} [category] Name of a Diagnostic Metric category for a - * resource type this setting is applied to. To obtain the list of Diagnostic - * metric categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this category is - * enabled. - * @member {object} [retentionPolicy] the retention policy for this category. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface MetricSettings { - timeGrain?: moment.Duration; - category?: string; - enabled: boolean; - retentionPolicy?: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the LogSettings class. - * @constructor - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular log. - * - * @member {string} [category] Name of a Diagnostic Log category for a resource - * type this setting is applied to. To obtain the list of Diagnostic Log - * categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this log is enabled. - * @member {object} [retentionPolicy] the retention policy for this log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface LogSettings { - category?: string; - enabled: boolean; - retentionPolicy?: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsResource class. - * @constructor - * The diagnostic setting resource. - * - * @member {string} [storageAccountId] The resource ID of the storage account - * to which you would like to send Diagnostic Logs. - * @member {string} [eventHubAuthorizationRuleId] The resource Id for the event - * hub authorization rule. - * @member {string} [eventHubName] The name of the event hub. If none is - * specified, the default event hub will be selected. - * @member {array} [metrics] the list of metric settings. - * @member {array} [logs] the list of logs settings. - * @member {string} [workspaceId] The workspace ID (resource ID of a Log - * Analytics workspace) for a Log Analytics workspace to which you would like - * to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - */ -export interface DiagnosticSettingsResource extends ProxyOnlyResource { - storageAccountId?: string; - eventHubAuthorizationRuleId?: string; - eventHubName?: string; - metrics?: MetricSettings[]; - logs?: LogSettings[]; - workspaceId?: string; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsResourceCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - * @member {array} [value] The collection of diagnostic settings resources;. - */ -export interface DiagnosticSettingsResourceCollection { - value?: DiagnosticSettingsResource[]; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsCategoryResource class. - * @constructor - * The diagnostic settings category resource. - * - * @member {string} [categoryType] The type of the diagnostic settings - * category. Possible values include: 'Metrics', 'Logs' - */ -export interface DiagnosticSettingsCategoryResource extends ProxyOnlyResource { - categoryType?: string; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsCategoryResourceCollection class. - * @constructor - * Represents a collection of diagnostic setting category resources. - * - * @member {array} [value] The collection of diagnostic settings category - * resources. - */ -export interface DiagnosticSettingsCategoryResourceCollection { - value?: DiagnosticSettingsCategoryResource[]; -} - -/** - * @class - * Initializes a new instance of the EmailReceiver class. - * @constructor - * An email receiver. - * - * @member {string} name The name of the email receiver. Names must be unique - * across all receivers within an action group. - * @member {string} emailAddress The email address of this receiver. - * @member {string} [status] The receiver status of the e-mail. Possible values - * include: 'NotSpecified', 'Enabled', 'Disabled' - */ -export interface EmailReceiver { - name: string; - emailAddress: string; - readonly status?: string; -} - -/** - * @class - * Initializes a new instance of the SmsReceiver class. - * @constructor - * An SMS receiver. - * - * @member {string} name The name of the SMS receiver. Names must be unique - * across all receivers within an action group. - * @member {string} countryCode The country code of the SMS receiver. - * @member {string} phoneNumber The phone number of the SMS receiver. - * @member {string} [status] The status of the receiver. Possible values - * include: 'NotSpecified', 'Enabled', 'Disabled' - */ -export interface SmsReceiver { - name: string; - countryCode: string; - phoneNumber: string; - readonly status?: string; -} - -/** - * @class - * Initializes a new instance of the WebhookReceiver class. - * @constructor - * A webhook receiver. - * - * @member {string} name The name of the webhook receiver. Names must be unique - * across all receivers within an action group. - * @member {string} serviceUri The URI where webhooks should be sent. - */ -export interface WebhookReceiver { - name: string; - serviceUri: string; -} - -/** - * @class - * Initializes a new instance of the ItsmReceiver class. - * @constructor - * An Itsm receiver. - * - * @member {string} name The name of the Itsm receiver. Names must be unique - * across all receivers within an action group. - * @member {string} workspaceId OMS LA instance identifier. - * @member {string} connectionId Unique identification of ITSM connection among - * multiple defined in above workspace. - * @member {string} ticketConfiguration JSON blob for the configurations of the - * ITSM action. CreateMultipleWorkItems option will be part of this blob as - * well. - * @member {string} region Region in which workspace resides. Supported - * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - */ -export interface ItsmReceiver { - name: string; - workspaceId: string; - connectionId: string; - ticketConfiguration: string; - region: string; -} - -/** - * @class - * Initializes a new instance of the AzureAppPushReceiver class. - * @constructor - * The Azure mobile App push notification receiver. - * - * @member {string} name The name of the Azure mobile app push receiver. Names - * must be unique across all receivers within an action group. - * @member {string} emailAddress The email address registered for the Azure - * mobile app. - */ -export interface AzureAppPushReceiver { - name: string; - emailAddress: string; -} - -/** - * @class - * Initializes a new instance of the AutomationRunbookReceiver class. - * @constructor - * The Azure Automation Runbook notification receiver. - * - * @member {string} automationAccountId The Azure automation account Id which - * holds this runbook and authenticate to Azure resource. - * @member {string} runbookName The name for this runbook. - * @member {string} webhookResourceId The resource id for webhook linked to - * this runbook. - * @member {boolean} isGlobalRunbook Indicates whether this instance is global - * runbook. - * @member {string} [name] Indicates name of the webhook. - * @member {string} [serviceUri] The URI where webhooks should be sent. - */ -export interface AutomationRunbookReceiver { - automationAccountId: string; - runbookName: string; - webhookResourceId: string; - isGlobalRunbook: boolean; - name?: string; - 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. - * @constructor - * An action group resource. - * - * @member {string} groupShortName The short name of the action group. This - * will be used in SMS messages. - * @member {boolean} enabled Indicates whether this action group is enabled. If - * an action group is not enabled, then none of its receivers will receive - * communications. Default value: true . - * @member {array} [emailReceivers] The list of email receivers that are part - * of this action group. - * @member {array} [smsReceivers] The list of SMS receivers that are part of - * this action group. - * @member {array} [webhookReceivers] The list of webhook receivers that are - * part of this action group. - * @member {array} [itsmReceivers] The list of ITSM receivers that are part of - * this action group. - * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers - * 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; - enabled: boolean; - emailReceivers?: EmailReceiver[]; - smsReceivers?: SmsReceiver[]; - webhookReceivers?: WebhookReceiver[]; - itsmReceivers?: ItsmReceiver[]; - azureAppPushReceivers?: AzureAppPushReceiver[]; - automationRunbookReceivers?: AutomationRunbookReceiver[]; - voiceReceivers?: VoiceReceiver[]; - logicAppReceivers?: LogicAppReceiver[]; - azureFunctionReceivers?: AzureFunctionReceiver[]; -} - -/** - * @class - * Initializes a new instance of the EnableRequest class. - * @constructor - * Describes a receiver that should be resubscribed. - * - * @member {string} receiverName The name of the receiver to resubscribe. - */ -export interface EnableRequest { - receiverName: string; -} - -/** - * @class - * Initializes a new instance of the ActionGroupPatchBody class. - * @constructor - * An action group object for the body of patch operations. - * - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this action group is enabled. - * If an action group is not enabled, then none of its actions will be - * activated. Default value: true . - */ -export interface ActionGroupPatchBody { - tags?: { [propertyName: string]: string }; - enabled?: boolean; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertLeafCondition class. - * @constructor - * An Activity Log alert condition that is met by comparing an activity log - * field and value. - * - * @member {string} field The name of the field that this condition will - * examine. The possible values for this field are (case-insensitive): - * 'resourceId', 'category', 'caller', 'level', 'operationName', - * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', - * or anything beginning with 'properties.'. - * @member {string} equals The field value will be compared to this value - * (case-insensitive) to determine if the condition is met. - */ -export interface ActivityLogAlertLeafCondition { - field: string; - equals: string; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertAllOfCondition class. - * @constructor - * An Activity Log alert condition that is met when all its member conditions - * are met. - * - * @member {array} allOf The list of activity log alert conditions. - */ -export interface ActivityLogAlertAllOfCondition { - allOf: ActivityLogAlertLeafCondition[]; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertActionGroup class. - * @constructor - * A pointer to an Azure Action Group. - * - * @member {string} actionGroupId The resourceId of the action group. This - * cannot be null or empty. - * @member {object} [webhookProperties] the dictionary of custom properties to - * include with the post operation. These data are appended to the webhook - * payload. - */ -export interface ActivityLogAlertActionGroup { - actionGroupId: string; - webhookProperties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertActionList class. - * @constructor - * A list of activity log alert actions. - * - * @member {array} [actionGroups] The list of activity log alerts. - */ -export interface ActivityLogAlertActionList { - actionGroups?: ActivityLogAlertActionGroup[]; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertResource class. - * @constructor - * An activity log alert resource. - * - * @member {array} scopes A list of resourceIds that will be used as prefixes. - * The alert will only apply to activityLogs with resourceIds that fall under - * one of these prefixes. This list must include at least one item. - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - * @member {object} condition The condition that will cause this alert to - * activate. - * @member {array} [condition.allOf] The list of activity log alert conditions. - * @member {object} actions The actions that will activate when the condition - * is met. - * @member {array} [actions.actionGroups] The list of activity log alerts. - * @member {string} [description] A description of this activity log alert. - */ -export interface ActivityLogAlertResource extends Resource { - scopes: string[]; - enabled?: boolean; - condition: ActivityLogAlertAllOfCondition; - actions: ActivityLogAlertActionList; - description?: string; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertPatchBody class. - * @constructor - * An activity log alert object for the body of patch operations. - * - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - */ -export interface ActivityLogAlertPatchBody { - tags?: { [propertyName: string]: string }; - enabled?: boolean; -} - -/** - * @class - * Initializes a new instance of the LocalizableString class. - * @constructor - * The localizable string class. - * - * @member {string} value the invariant value. - * @member {string} [localizedValue] the locale specific value. - */ -export interface LocalizableString { - value: string; - localizedValue?: string; -} - -/** - * @class - * Initializes a new instance of the SenderAuthorization class. - * @constructor - * the authorization used by the user who has performed the operation that led - * to this event. This captures the RBAC properties of the event. These usually - * include the 'action', 'role' and the 'scope' - * - * @member {string} [action] the permissible actions. For instance: - * microsoft.support/supporttickets/write - * @member {string} [role] the role of the user. For instance: Subscription - * Admin - * @member {string} [scope] the scope. - */ -export interface SenderAuthorization { - action?: string; - role?: string; - scope?: string; -} - -/** - * @class - * Initializes a new instance of the HttpRequestInfo class. - * @constructor - * The Http request info. - * - * @member {string} [clientRequestId] the client request id. - * @member {string} [clientIpAddress] the client Ip Address - * @member {string} [method] the Http request method. - * @member {string} [uri] the Uri. - */ -export interface HttpRequestInfo { - clientRequestId?: string; - clientIpAddress?: string; - method?: string; - uri?: string; -} - -/** - * @class - * Initializes a new instance of the EventData class. - * @constructor - * The Azure event log entries are of type EventData - * - * @member {object} [authorization] - * @member {string} [authorization.action] the permissible actions. For - * instance: microsoft.support/supporttickets/write - * @member {string} [authorization.role] the role of the user. For instance: - * Subscription Admin - * @member {string} [authorization.scope] the scope. - * @member {object} [claims] key value pairs to identify ARM permissions. - * @member {string} [caller] the email address of the user who has performed - * the operation, the UPN claim or SPN claim based on availability. - * @member {string} [description] the description of the event. - * @member {string} [id] the Id of this event as required by ARM for RBAC. It - * contains the EventDataID and a timestamp information. - * @member {string} [eventDataId] the event data Id. This is a unique - * identifier for an event. - * @member {string} [correlationId] the correlation Id, usually a GUID in the - * string format. The correlation Id is shared among the events that belong to - * the same uber operation. - * @member {object} [eventName] the event name. This value should not be - * confused with OperationName. For practical purposes, OperationName might be - * more appealing to end users. - * @member {string} [eventName.value] the invariant value. - * @member {string} [eventName.localizedValue] the locale specific value. - * @member {object} [category] the event category. - * @member {string} [category.value] the invariant value. - * @member {string} [category.localizedValue] the locale specific value. - * @member {object} [httpRequest] the HTTP request info. Usually includes the - * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated - * the event) and 'method' (HTTP method e.g. PUT). - * @member {string} [httpRequest.clientRequestId] the client request id. - * @member {string} [httpRequest.clientIpAddress] the client Ip Address - * @member {string} [httpRequest.method] the Http request method. - * @member {string} [httpRequest.uri] the Uri. - * @member {string} [level] the event level. Possible values include: - * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - * @member {string} [resourceGroupName] the resource group name of the impacted - * resource. - * @member {object} [resourceProviderName] the resource provider name of the - * impacted resource. - * @member {string} [resourceProviderName.value] the invariant value. - * @member {string} [resourceProviderName.localizedValue] the locale specific - * value. - * @member {string} [resourceId] the resource uri that uniquely identifies the - * resource that caused this event. - * @member {object} [resourceType] the resource type - * @member {string} [resourceType.value] the invariant value. - * @member {string} [resourceType.localizedValue] the locale specific value. - * @member {string} [operationId] It is usually a GUID shared among the events - * corresponding to single operation. This value should not be confused with - * EventName. - * @member {object} [operationName] the operation name. - * @member {string} [operationName.value] the invariant value. - * @member {string} [operationName.localizedValue] the locale specific value. - * @member {object} [properties] the set of pairs (usually a - * Dictionary) that includes details about the event. - * @member {object} [status] a string describing the status of the operation. - * Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - * @member {string} [status.value] the invariant value. - * @member {string} [status.localizedValue] the locale specific value. - * @member {object} [subStatus] the event sub status. Most of the time, when - * included, this captures the HTTP status code of the REST call. Common values - * are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted - * (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad - * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict - * (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), - * Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status - * Code: 504) - * @member {string} [subStatus.value] the invariant value. - * @member {string} [subStatus.localizedValue] the locale specific value. - * @member {date} [eventTimestamp] the timestamp of when the event was - * generated by the Azure service processing the request corresponding the - * event. It in ISO 8601 format. - * @member {date} [submissionTimestamp] the timestamp of when the event became - * available for querying via this API. It is in ISO 8601 format. This value - * should not be confused eventTimestamp. As there might be a delay between the - * occurrence time of the event, and the time that the event is submitted to - * the Azure logging infrastructure. - * @member {string} [subscriptionId] the Azure subscription Id usually a GUID. - * @member {string} [tenantId] the Azure tenant Id - */ -export interface EventData { - readonly authorization?: SenderAuthorization; - readonly claims?: { [propertyName: string]: string }; - readonly caller?: string; - readonly description?: string; - readonly id?: string; - readonly eventDataId?: string; - readonly correlationId?: string; - readonly eventName?: LocalizableString; - readonly category?: LocalizableString; - readonly httpRequest?: HttpRequestInfo; - readonly level?: string; - readonly resourceGroupName?: string; - readonly resourceProviderName?: LocalizableString; - readonly resourceId?: string; - readonly resourceType?: LocalizableString; - readonly operationId?: string; - readonly operationName?: LocalizableString; - readonly properties?: { [propertyName: string]: string }; - readonly status?: LocalizableString; - readonly subStatus?: LocalizableString; - readonly eventTimestamp?: Date; - readonly submissionTimestamp?: Date; - readonly subscriptionId?: string; - readonly tenantId?: string; -} - -/** - * @class - * Initializes a new instance of the MetricAvailability class. - * @constructor - * Metric availability specifies the time grain (aggregation interval or - * frequency) and the retention period for that time grain. - * - * @member {moment.duration} [timeGrain] the time grain specifies the - * aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', - * etc. - * @member {moment.duration} [retention] the retention period for the metric at - * the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - */ -export interface MetricAvailability { - timeGrain?: moment.Duration; - retention?: moment.Duration; -} - -/** - * @class - * Initializes a new instance of the MetricDefinition class. - * @constructor - * Metric definition class specifies the metadata for a metric. - * - * @member {boolean} [isDimensionRequired] Flag to indicate whether the - * dimension is required. - * @member {string} [resourceId] the resource identifier of the resource that - * emitted the metric. - * @member {string} [namespace] the namespace the metric blongs to. - * @member {object} [name] the name and the display name of the metric, i.e. it - * is a localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [unit] the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', - * 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {string} [primaryAggregationType] the primary aggregation type value - * defining how to use the values for display. Possible values include: 'None', - * 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - * @member {array} [supportedAggregationTypes] the collection of what - * aggregation types are supported. - * @member {array} [metricAvailabilities] the collection of what aggregation - * intervals are available to be queried. - * @member {string} [id] the resource identifier of the metric definition. - * @member {array} [dimensions] the name and the display name of the dimension, - * i.e. it is a localizable string. - */ -export interface MetricDefinition { - isDimensionRequired?: boolean; - resourceId?: string; - namespace?: string; - name?: LocalizableString; - unit?: string; - primaryAggregationType?: string; - supportedAggregationTypes?: string[]; - metricAvailabilities?: MetricAvailability[]; - id?: string; - dimensions?: LocalizableString[]; -} - -/** - * @class - * Initializes a new instance of the MetricValue class. - * @constructor - * Represents a metric value. - * - * @member {date} timeStamp the timestamp for the metric value in ISO 8601 - * format. - * @member {number} [average] the average value in the time range. - * @member {number} [minimum] the least value in the time range. - * @member {number} [maximum] the greatest value in the time range. - * @member {number} [total] the sum of all of the values in the time range. - * @member {number} [count] the number of samples in the time range. Can be - * used to determine the number of values that contributed to the average - * value. - */ -export interface MetricValue { - timeStamp: Date; - average?: number; - minimum?: number; - maximum?: number; - total?: number; - count?: number; -} - -/** - * @class - * Initializes a new instance of the MetadataValue class. - * @constructor - * Represents a metric metadata value. - * - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ -export interface MetadataValue { - name?: LocalizableString; - value?: string; -} - -/** - * @class - * Initializes a new instance of the TimeSeriesElement class. - * @constructor - * A time series result type. The discriminator value is always TimeSeries in - * this case. - * - * @member {array} [metadatavalues] the metadata values returned if $filter was - * specified in the call. - * @member {array} [data] An array of data points representing the metric - * values. This is only returned if a result type of data is specified. - */ -export interface TimeSeriesElement { - metadatavalues?: MetadataValue[]; - data?: MetricValue[]; -} - -/** - * @class - * Initializes a new instance of the Metric class. - * @constructor - * The result data of a query. - * - * @member {string} id the metric Id. - * @member {string} type the resource type of the metric resource. - * @member {object} name the name and the display name of the metric, i.e. it - * is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} unit the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', - * 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {array} timeseries the time series returned when a data query is - * performed. - */ -export interface Metric { - id: string; - type: string; - name: LocalizableString; - unit: string; - timeseries: TimeSeriesElement[]; -} - -/** - * @class - * Initializes a new instance of the Response class. - * @constructor - * The response to a metrics query. - * - * @member {number} [cost] The integer value representing the cost of the - * query, for data case. - * @member {string} timespan The timespan for which the data was retrieved. Its - * value consists of two datatimes concatenated, separated by '/'. This may be - * adjusted in the future and returned back from what was originally requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if a - * metadata request was made. - * @member {string} [namespace] The namespace of the metrics been queried - * @member {string} [resourceregion] The region of the resource been queried - * for metrics. - * @member {array} value the value of the collection. - */ -export interface Response { - cost?: number; - timespan: string; - interval?: moment.Duration; - namespace?: string; - resourceregion?: string; - value: Metric[]; -} - -/** - * @class - * Initializes a new instance of the BaselineMetadataValue class. - * @constructor - * Represents a baseline metadata value. - * - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ -export interface BaselineMetadataValue { - name?: LocalizableString; - value?: string; -} - -/** - * @class - * Initializes a new instance of the Baseline class. - * @constructor - * The baseline values for a single sensitivity value. - * - * @member {string} sensitivity the sensitivity of the baseline. Possible - * values include: 'Low', 'Medium', 'High' - * @member {array} lowThresholds The low thresholds of the baseline. - * @member {array} highThresholds The high thresholds of the baseline. - */ -export interface Baseline { - sensitivity: string; - lowThresholds: number[]; - highThresholds: number[]; -} - -/** - * @class - * Initializes a new instance of the BaselineResponse class. - * @constructor - * The response to a baseline query. - * - * @member {string} [id] the metric baseline Id. - * @member {string} [type] the resource type of the baseline resource. - * @member {object} [name] the name and the display name of the metric, i.e. it - * is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [timespan] The timespan for which the data was retrieved. - * Its value consists of two datatimes concatenated, separated by '/'. This - * may be adjusted in the future and returned back from what was originally - * requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if a - * metadata request was made. - * @member {string} [aggregation] The aggregation type of the metric. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} [baseline] the baseline values for each sensitivity. - * @member {array} [metadata] the baseline metadata values. - */ -export interface BaselineResponse { - readonly id?: string; - readonly type?: string; - readonly name?: LocalizableString; - timespan?: string; - interval?: moment.Duration; - aggregation?: string; - timestamps?: Date[]; - baseline?: Baseline[]; - metadata?: BaselineMetadataValue[]; -} - -/** - * @class - * Initializes a new instance of the TimeSeriesInformation class. - * @constructor - * The time series info needed for calculating the baseline. - * - * @member {array} sensitivities the list of sensitivities for calculating the - * baseline. - * @member {array} values The metric values to calculate the baseline. - * @member {array} [timestamps] the array of timestamps of the baselines. - */ -export interface TimeSeriesInformation { - sensitivities: string[]; - values: number[]; - timestamps?: Date[]; -} - -/** - * @class - * Initializes a new instance of the CalculateBaselineResponse class. - * @constructor - * The response to a calcualte baseline call. - * - * @member {string} type the resource type of the baseline resource. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} baseline the baseline values for each sensitivity. - */ -export interface CalculateBaselineResponse { - type: string; - timestamps?: Date[]; - baseline: Baseline[]; -} - -/** - * @class - * Initializes a new instance of the Action class. - * @constructor - * An alert action. - * - * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] - */ -export interface Action { - actionGroupId?: string; - webhookProperties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the MetricAlertCriteria class. - * @constructor - * The rule criteria that defines the conditions of the alert rule. - * - * @member {string} odatatype Polymorphic Discriminator - */ -export interface MetricAlertCriteria { - odatatype: string; - /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. - */ - [property: string]: any; -} - -/** - * @class - * Initializes a new instance of the MetricAlertResource class. - * @constructor - * The metric alert resource. - * - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert is - * scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert is - * evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface MetricAlertResource extends Resource { - description: string; - severity: number; - enabled: boolean; - scopes?: string[]; - evaluationFrequency: moment.Duration; - windowSize: moment.Duration; - criteria: MetricAlertCriteria; - actions?: Action[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the MetricAlertResourcePatch class. - * @constructor - * The metric alert resource for patch operations. - * - * @member {object} [tags] Resource tags - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert is - * scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert is - * evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface MetricAlertResourcePatch { - tags?: { [propertyName: string]: string }; - description: string; - severity: number; - enabled: boolean; - scopes?: string[]; - evaluationFrequency: moment.Duration; - windowSize: moment.Duration; - criteria: MetricAlertCriteria; - actions?: Action[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the MetricAlertStatusProperties class. - * @constructor - * An alert status properties. - * - * @member {object} [dimensions] - * @member {string} [status] status value - * @member {date} [timestamp] UTC time when the status was checked. - */ -export interface MetricAlertStatusProperties { - dimensions?: { [propertyName: string]: string }; - status?: string; - timestamp?: Date; -} - -/** - * @class - * Initializes a new instance of the MetricAlertStatus class. - * @constructor - * An alert status. - * - * @member {string} [name] The status name. - * @member {string} [id] The alert rule arm id. - * @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 {string} [properties.status] status value - * @member {date} [properties.timestamp] UTC time when the status was checked. - */ -export interface MetricAlertStatus { - name?: string; - id?: string; - type?: string; - properties?: MetricAlertStatusProperties; -} - -/** - * @class - * Initializes a new instance of the MetricAlertStatusCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - * @member {array} [value] the values for the alert rule resources. - */ -export interface MetricAlertStatusCollection { - value?: MetricAlertStatus[]; -} - -/** - * @class - * Initializes a new instance of the MetricDimension class. - * @constructor - * @member {string} name Name of the dimension. - * @member {string} operator the dimension operator. - * @member {array} values list of dimension values. - */ -export interface MetricDimension { - name: string; - operator: string; - values: string[]; -} - -/** - * @class - * Initializes a new instance of the MetricCriteria class. - * @constructor - * @member {string} name Name of the criteria. - * @member {string} metricName Name of the metric. - * @member {string} [metricNamespace] Namespace of the metric. - * @member {object} operator the criteria operator. - * @member {object} timeAggregation the criteria time aggregation types. - * @member {number} threshold the criteria threshold value that activates the - * alert. - * @member {array} [dimensions] List of dimension conditions. - */ -export interface MetricCriteria { - name: string; - metricName: string; - metricNamespace?: string; - operator: any; - timeAggregation: any; - threshold: number; - dimensions?: MetricDimension[]; -} - -/** - * @class - * Initializes a new instance of the MetricAlertSingleResourceMultipleMetricCriteria class. - * @constructor - * Specifies the metric alert criteria for a single resource that has multiple - * metric criteria. - * - * @member {array} [allOf] The list of metric criteria for this 'all of' - * operation. - */ -export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { - allOf?: MetricCriteria[]; -} - - -/** - * @class - * Initializes a new instance of the AutoscaleSettingResourceCollection class. - * @constructor - * Represents a collection of autoscale setting resources. - * - * @member {string} [nextLink] URL to get the next set of results. - */ -export interface AutoscaleSettingResourceCollection extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the IncidentListResult class. - * @constructor - * The List incidents operation response. - * - */ -export interface IncidentListResult extends Array { -} - -/** - * @class - * Initializes a new instance of the AlertRuleResourceCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - */ -export interface AlertRuleResourceCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the LogProfileCollection class. - * @constructor - * Represents a collection of log profiles. - * - */ -export interface LogProfileCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the ActionGroupList class. - * @constructor - * A list of action groups. - * - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ -export interface ActionGroupList extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertList class. - * @constructor - * A list of activity log alerts. - * - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ -export interface ActivityLogAlertList extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the EventDataCollection class. - * @constructor - * Represents collection of events. - * - * @member {string} [nextLink] Provides the link to retrieve the next set of - * events. - */ -export interface EventDataCollection extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the EventCategoryCollection class. - * @constructor - * A collection of event categories. Currently possible values are: - * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. - * - */ -export interface EventCategoryCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the MetricDefinitionCollection class. - * @constructor - * Represents collection of metric definitions. - * - */ -export interface MetricDefinitionCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the MetricAlertResourceCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - */ -export interface MetricAlertResourceCollection extends Array { -} diff --git a/lib/services/monitor/lib/lib/models/index.js b/lib/services/monitor/lib/lib/models/index.js deleted file mode 100644 index 878adabbd3..0000000000 --- a/lib/services/monitor/lib/lib/models/index.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -var msRestAzure = require('ms-rest-azure'); - -exports.BaseResource = msRestAzure.BaseResource; -exports.CloudError = msRestAzure.CloudError; -exports.Resource = require('./resource'); -exports.ScaleCapacity = require('./scaleCapacity'); -exports.MetricTrigger = require('./metricTrigger'); -exports.ScaleAction = require('./scaleAction'); -exports.ScaleRule = require('./scaleRule'); -exports.TimeWindow = require('./timeWindow'); -exports.RecurrentSchedule = require('./recurrentSchedule'); -exports.Recurrence = require('./recurrence'); -exports.AutoscaleProfile = require('./autoscaleProfile'); -exports.EmailNotification = require('./emailNotification'); -exports.WebhookNotification = require('./webhookNotification'); -exports.AutoscaleNotification = require('./autoscaleNotification'); -exports.AutoscaleSettingResource = require('./autoscaleSettingResource'); -exports.AutoscaleSettingResourcePatch = require('./autoscaleSettingResourcePatch'); -exports.ErrorResponse = require('./errorResponse'); -exports.OperationDisplay = require('./operationDisplay'); -exports.Operation = require('./operation'); -exports.OperationListResult = require('./operationListResult'); -exports.Incident = require('./incident'); -exports.RuleDataSource = require('./ruleDataSource'); -exports.RuleCondition = require('./ruleCondition'); -exports.RuleMetricDataSource = require('./ruleMetricDataSource'); -exports.RuleManagementEventClaimsDataSource = require('./ruleManagementEventClaimsDataSource'); -exports.RuleManagementEventDataSource = require('./ruleManagementEventDataSource'); -exports.ThresholdRuleCondition = require('./thresholdRuleCondition'); -exports.LocationThresholdRuleCondition = require('./locationThresholdRuleCondition'); -exports.ManagementEventAggregationCondition = require('./managementEventAggregationCondition'); -exports.ManagementEventRuleCondition = require('./managementEventRuleCondition'); -exports.RuleAction = require('./ruleAction'); -exports.RuleEmailAction = require('./ruleEmailAction'); -exports.RuleWebhookAction = require('./ruleWebhookAction'); -exports.AlertRuleResource = require('./alertRuleResource'); -exports.AlertRuleResourcePatch = require('./alertRuleResourcePatch'); -exports.RetentionPolicy = require('./retentionPolicy'); -exports.LogProfileResource = require('./logProfileResource'); -exports.LogProfileResourcePatch = require('./logProfileResourcePatch'); -exports.ProxyOnlyResource = require('./proxyOnlyResource'); -exports.MetricSettings = require('./metricSettings'); -exports.LogSettings = require('./logSettings'); -exports.DiagnosticSettingsResource = require('./diagnosticSettingsResource'); -exports.DiagnosticSettingsResourceCollection = require('./diagnosticSettingsResourceCollection'); -exports.DiagnosticSettingsCategoryResource = require('./diagnosticSettingsCategoryResource'); -exports.DiagnosticSettingsCategoryResourceCollection = require('./diagnosticSettingsCategoryResourceCollection'); -exports.EmailReceiver = require('./emailReceiver'); -exports.SmsReceiver = require('./smsReceiver'); -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'); -exports.ActivityLogAlertLeafCondition = require('./activityLogAlertLeafCondition'); -exports.ActivityLogAlertAllOfCondition = require('./activityLogAlertAllOfCondition'); -exports.ActivityLogAlertActionGroup = require('./activityLogAlertActionGroup'); -exports.ActivityLogAlertActionList = require('./activityLogAlertActionList'); -exports.ActivityLogAlertResource = require('./activityLogAlertResource'); -exports.ActivityLogAlertPatchBody = require('./activityLogAlertPatchBody'); -exports.LocalizableString = require('./localizableString'); -exports.SenderAuthorization = require('./senderAuthorization'); -exports.HttpRequestInfo = require('./httpRequestInfo'); -exports.EventData = require('./eventData'); -exports.MetricAvailability = require('./metricAvailability'); -exports.MetricDefinition = require('./metricDefinition'); -exports.MetricValue = require('./metricValue'); -exports.MetadataValue = require('./metadataValue'); -exports.TimeSeriesElement = require('./timeSeriesElement'); -exports.Metric = require('./metric'); -exports.Response = require('./response'); -exports.BaselineMetadataValue = require('./baselineMetadataValue'); -exports.Baseline = require('./baseline'); -exports.BaselineResponse = require('./baselineResponse'); -exports.TimeSeriesInformation = require('./timeSeriesInformation'); -exports.CalculateBaselineResponse = require('./calculateBaselineResponse'); -exports.Action = require('./action'); -exports.MetricAlertCriteria = require('./metricAlertCriteria'); -exports.MetricAlertResource = require('./metricAlertResource'); -exports.MetricAlertResourcePatch = require('./metricAlertResourcePatch'); -exports.MetricAlertStatusProperties = require('./metricAlertStatusProperties'); -exports.MetricAlertStatus = require('./metricAlertStatus'); -exports.MetricAlertStatusCollection = require('./metricAlertStatusCollection'); -exports.MetricDimension = require('./metricDimension'); -exports.MetricCriteria = require('./metricCriteria'); -exports.MetricAlertSingleResourceMultipleMetricCriteria = require('./metricAlertSingleResourceMultipleMetricCriteria'); -exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); -exports.IncidentListResult = require('./incidentListResult'); -exports.AlertRuleResourceCollection = require('./alertRuleResourceCollection'); -exports.LogProfileCollection = require('./logProfileCollection'); -exports.ActionGroupList = require('./actionGroupList'); -exports.ActivityLogAlertList = require('./activityLogAlertList'); -exports.EventDataCollection = require('./eventDataCollection'); -exports.EventCategoryCollection = require('./eventCategoryCollection'); -exports.MetricDefinitionCollection = require('./metricDefinitionCollection'); -exports.MetricAlertResourceCollection = require('./metricAlertResourceCollection'); -exports.discriminators = { - 'RuleDataSource' : exports.RuleDataSource, - 'RuleCondition' : exports.RuleCondition, - 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' : exports.RuleMetricDataSource, - 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' : exports.RuleManagementEventDataSource, - 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' : exports.ThresholdRuleCondition, - 'RuleCondition.Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' : exports.LocationThresholdRuleCondition, - 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' : exports.ManagementEventRuleCondition, - 'RuleAction' : exports.RuleAction, - '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 -}; diff --git a/lib/services/monitor/lib/lib/models/itsmReceiver.js b/lib/services/monitor/lib/lib/models/itsmReceiver.js deleted file mode 100644 index a46c94b4d3..0000000000 --- a/lib/services/monitor/lib/lib/models/itsmReceiver.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 Itsm receiver. - * - */ -class ItsmReceiver { - /** - * Create a ItsmReceiver. - * @member {string} name The name of the Itsm receiver. Names must be unique - * across all receivers within an action group. - * @member {string} workspaceId OMS LA instance identifier. - * @member {string} connectionId Unique identification of ITSM connection - * among multiple defined in above workspace. - * @member {string} ticketConfiguration JSON blob for the configurations of - * the ITSM action. CreateMultipleWorkItems option will be part of this blob - * as well. - * @member {string} region Region in which workspace resides. Supported - * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - */ - constructor() { - } - - /** - * Defines the metadata of ItsmReceiver - * - * @returns {object} metadata of ItsmReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'ItsmReceiver', - type: { - name: 'Composite', - className: 'ItsmReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - workspaceId: { - required: true, - serializedName: 'workspaceId', - type: { - name: 'String' - } - }, - connectionId: { - required: true, - serializedName: 'connectionId', - type: { - name: 'String' - } - }, - ticketConfiguration: { - required: true, - serializedName: 'ticketConfiguration', - type: { - name: 'String' - } - }, - region: { - required: true, - serializedName: 'region', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ItsmReceiver; diff --git a/lib/services/monitor/lib/lib/models/localizableString.js b/lib/services/monitor/lib/lib/models/localizableString.js deleted file mode 100644 index 357dc90351..0000000000 --- a/lib/services/monitor/lib/lib/models/localizableString.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 localizable string class. - * - */ -class LocalizableString { - /** - * Create a LocalizableString. - * @member {string} value the invariant value. - * @member {string} [localizedValue] the locale specific value. - */ - constructor() { - } - - /** - * Defines the metadata of LocalizableString - * - * @returns {object} metadata of LocalizableString - * - */ - mapper() { - return { - required: false, - serializedName: 'LocalizableString', - type: { - name: 'Composite', - className: 'LocalizableString', - modelProperties: { - value: { - required: true, - serializedName: 'value', - type: { - name: 'String' - } - }, - localizedValue: { - required: false, - serializedName: 'localizedValue', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = LocalizableString; diff --git a/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js deleted file mode 100644 index c432f200c8..0000000000 --- a/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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'); - -/** - * A rule condition based on a certain number of locations failing. - * - * @extends models['RuleCondition'] - */ -class LocationThresholdRuleCondition extends models['RuleCondition'] { - /** - * Create a LocationThresholdRuleCondition. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {number} failedLocationCount the number of locations that must - * fail to activate the alert. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LocationThresholdRuleCondition - * - * @returns {object} metadata of LocationThresholdRuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'LocationThresholdRuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - windowSize: { - required: false, - serializedName: 'windowSize', - type: { - name: 'TimeSpan' - } - }, - failedLocationCount: { - required: true, - serializedName: 'failedLocationCount', - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = LocationThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/logProfileCollection.js b/lib/services/monitor/lib/lib/models/logProfileCollection.js deleted file mode 100644 index d2530db617..0000000000 --- a/lib/services/monitor/lib/lib/models/logProfileCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 profiles. - */ -class LogProfileCollection extends Array { - /** - * Create a LogProfileCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LogProfileCollection - * - * @returns {object} metadata of LogProfileCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'LogProfileCollection', - type: { - name: 'Composite', - className: 'LogProfileCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LogProfileResourceElementType', - type: { - name: 'Composite', - className: 'LogProfileResource' - } - } - } - } - } - } - }; - } -} - -module.exports = LogProfileCollection; diff --git a/lib/services/monitor/lib/lib/models/logProfileResource.js b/lib/services/monitor/lib/lib/models/logProfileResource.js deleted file mode 100644 index 69a8f54034..0000000000 --- a/lib/services/monitor/lib/lib/models/logProfileResource.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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 profile resource. - * - * @extends models['Resource'] - */ -class LogProfileResource extends models['Resource'] { - /** - * Create a LogProfileResource. - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories - * are created as is convenient to the user. Some values are: 'Write', - * 'Delete', and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in - * the log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LogProfileResource - * - * @returns {object} metadata of LogProfileResource - * - */ - mapper() { - return { - required: false, - serializedName: 'LogProfileResource', - type: { - name: 'Composite', - className: 'LogProfileResource', - 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' - } - } - } - }, - storageAccountId: { - required: false, - serializedName: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - serviceBusRuleId: { - required: false, - serializedName: 'properties.serviceBusRuleId', - type: { - name: 'String' - } - }, - locations: { - required: true, - serializedName: 'properties.locations', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - categories: { - required: true, - serializedName: 'properties.categories', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - retentionPolicy: { - required: true, - serializedName: 'properties.retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = LogProfileResource; diff --git a/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js b/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js deleted file mode 100644 index f9b2822b45..0000000000 --- a/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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 profile resource for patch operations. - * - */ -class LogProfileResourcePatch { - /** - * Create a LogProfileResourcePatch. - * @member {object} [tags] Resource tags - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories - * are created as is convenient to the user. Some values are: 'Write', - * 'Delete', and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in - * the log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of LogProfileResourcePatch - * - * @returns {object} metadata of LogProfileResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'LogProfileResourcePatch', - type: { - name: 'Composite', - className: 'LogProfileResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - storageAccountId: { - required: false, - serializedName: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - serviceBusRuleId: { - required: false, - serializedName: 'properties.serviceBusRuleId', - type: { - name: 'String' - } - }, - locations: { - required: true, - serializedName: 'properties.locations', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - categories: { - required: true, - serializedName: 'properties.categories', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - retentionPolicy: { - required: true, - serializedName: 'properties.retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = LogProfileResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/logSettings.js b/lib/services/monitor/lib/lib/models/logSettings.js deleted file mode 100644 index de7aa7b6c6..0000000000 --- a/lib/services/monitor/lib/lib/models/logSettings.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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'); - -/** - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular log. - * - */ -class LogSettings { - /** - * Create a LogSettings. - * @member {string} [category] Name of a Diagnostic Log category for a - * resource type this setting is applied to. To obtain the list of Diagnostic - * Log categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this log is enabled. - * @member {object} [retentionPolicy] the retention policy for this log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of LogSettings - * - * @returns {object} metadata of LogSettings - * - */ - mapper() { - return { - required: false, - serializedName: 'LogSettings', - type: { - name: 'Composite', - className: 'LogSettings', - modelProperties: { - category: { - required: false, - serializedName: 'category', - type: { - name: 'String' - } - }, - enabled: { - required: true, - serializedName: 'enabled', - type: { - name: 'Boolean' - } - }, - retentionPolicy: { - required: false, - serializedName: 'retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = LogSettings; diff --git a/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js b/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js deleted file mode 100644 index 29aa3f55f9..0000000000 --- a/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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'; - -/** - * How the data that is collected should be combined over time. - * - */ -class ManagementEventAggregationCondition { - /** - * Create a ManagementEventAggregationCondition. - * @member {string} [operator] the condition operator. Possible values - * include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [threshold] The threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - */ - constructor() { - } - - /** - * Defines the metadata of ManagementEventAggregationCondition - * - * @returns {object} metadata of ManagementEventAggregationCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'ManagementEventAggregationCondition', - type: { - name: 'Composite', - className: 'ManagementEventAggregationCondition', - modelProperties: { - operator: { - required: false, - serializedName: 'operator', - type: { - name: 'Enum', - allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] - } - }, - threshold: { - required: false, - serializedName: 'threshold', - type: { - name: 'Number' - } - }, - windowSize: { - required: false, - serializedName: 'windowSize', - type: { - name: 'TimeSpan' - } - } - } - } - }; - } -} - -module.exports = ManagementEventAggregationCondition; diff --git a/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js b/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js deleted file mode 100644 index d06bfc5742..0000000000 --- a/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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'); - -/** - * A management event rule condition. - * - * @extends models['RuleCondition'] - */ -class ManagementEventRuleCondition extends models['RuleCondition'] { - /** - * Create a ManagementEventRuleCondition. - * @member {object} [aggregation] How the data that is collected should be - * combined over time and when the alert is activated. Note that for - * management event alerts aggregation is optional – if it is not provided - * then any event will cause the alert to activate. - * @member {string} [aggregation.operator] the condition operator. Possible - * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [aggregation.threshold] The threshold value that - * activates the alert. - * @member {moment.duration} [aggregation.windowSize] the period of time (in - * ISO 8601 duration format) that is used to monitor alert activity based on - * the threshold. If specified then it must be between 5 minutes and 1 day. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ManagementEventRuleCondition - * - * @returns {object} metadata of ManagementEventRuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'ManagementEventRuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - aggregation: { - required: false, - serializedName: 'aggregation', - type: { - name: 'Composite', - className: 'ManagementEventAggregationCondition' - } - } - } - } - }; - } -} - -module.exports = ManagementEventRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/metadataValue.js b/lib/services/monitor/lib/lib/models/metadataValue.js deleted file mode 100644 index e57162fef2..0000000000 --- a/lib/services/monitor/lib/lib/models/metadataValue.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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'); - -/** - * Represents a metric metadata value. - * - */ -class MetadataValue { - /** - * Create a MetadataValue. - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ - constructor() { - } - - /** - * Defines the metadata of MetadataValue - * - * @returns {object} metadata of MetadataValue - * - */ - mapper() { - return { - required: false, - serializedName: 'MetadataValue', - type: { - name: 'Composite', - className: 'MetadataValue', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - value: { - required: false, - serializedName: 'value', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = MetadataValue; diff --git a/lib/services/monitor/lib/lib/models/metric.js b/lib/services/monitor/lib/lib/models/metric.js deleted file mode 100644 index 62f4e00afc..0000000000 --- a/lib/services/monitor/lib/lib/models/metric.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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 result data of a query. - * - */ -class Metric { - /** - * Create a Metric. - * @member {string} id the metric Id. - * @member {string} type the resource type of the metric resource. - * @member {object} name the name and the display name of the metric, i.e. it - * is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} unit the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {array} timeseries the time series returned when a data query is - * performed. - */ - constructor() { - } - - /** - * Defines the metadata of Metric - * - * @returns {object} metadata of Metric - * - */ - mapper() { - return { - required: false, - serializedName: 'Metric', - type: { - name: 'Composite', - className: 'Metric', - modelProperties: { - id: { - required: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - type: { - required: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - name: { - required: true, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - unit: { - required: true, - serializedName: 'unit', - type: { - name: 'Enum', - allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] - } - }, - timeseries: { - required: true, - serializedName: 'timeseries', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'TimeSeriesElementElementType', - type: { - name: 'Composite', - className: 'TimeSeriesElement' - } - } - } - } - } - } - }; - } -} - -module.exports = Metric; diff --git a/lib/services/monitor/lib/lib/models/metricAlertCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertCriteria.js deleted file mode 100644 index 1a423dbb2d..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertCriteria.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 rule criteria that defines the conditions of the alert rule. - * - */ -class MetricAlertCriteria { - /** - * Create a MetricAlertCriteria. - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertCriteria - * - * @returns {object} metadata of MetricAlertCriteria - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertCriteria', - type: { - name: 'Composite', - additionalProperties: { - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'ObjectElementType', - type: { - name: 'Object' - } - } - } - }, - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertCriteria', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = MetricAlertCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResource.js b/lib/services/monitor/lib/lib/models/metricAlertResource.js deleted file mode 100644 index c21174220c..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertResource.js +++ /dev/null @@ -1,208 +0,0 @@ -/* - * 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 metric alert resource. - * - * @extends models['Resource'] - */ -class MetricAlertResource extends models['Resource'] { - /** - * Create a MetricAlertResource. - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert - * is scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert - * is evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricAlertResource - * - * @returns {object} metadata of MetricAlertResource - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertResource', - type: { - name: 'Composite', - className: 'MetricAlertResource', - 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: true, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - severity: { - required: true, - serializedName: 'properties.severity', - type: { - name: 'Number' - } - }, - enabled: { - required: true, - serializedName: 'properties.enabled', - type: { - name: 'Boolean' - } - }, - scopes: { - required: false, - serializedName: 'properties.scopes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - evaluationFrequency: { - required: true, - serializedName: 'properties.evaluationFrequency', - type: { - name: 'TimeSpan' - } - }, - windowSize: { - required: true, - serializedName: 'properties.windowSize', - type: { - name: 'TimeSpan' - } - }, - criteria: { - required: true, - serializedName: 'properties.criteria', - type: { - name: 'Composite', - additionalProperties: { - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'ObjectElementType', - type: { - name: 'Object' - } - } - } - }, - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertCriteria' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionElementType', - type: { - name: 'Composite', - className: 'Action' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = MetricAlertResource; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js b/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js deleted file mode 100644 index 4e54250e8c..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 alert rule resources. - */ -class MetricAlertResourceCollection extends Array { - /** - * Create a MetricAlertResourceCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricAlertResourceCollection - * - * @returns {object} metadata of MetricAlertResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertResourceCollection', - type: { - name: 'Composite', - className: 'MetricAlertResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricAlertResourceElementType', - type: { - name: 'Composite', - className: 'MetricAlertResource' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricAlertResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js b/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js deleted file mode 100644 index 1832373f2d..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 metric alert resource for patch operations. - * - */ -class MetricAlertResourcePatch { - /** - * Create a MetricAlertResourcePatch. - * @member {object} [tags] Resource tags - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert - * is scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert - * is evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertResourcePatch - * - * @returns {object} metadata of MetricAlertResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertResourcePatch', - type: { - name: 'Composite', - className: 'MetricAlertResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - description: { - required: true, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - severity: { - required: true, - serializedName: 'properties.severity', - type: { - name: 'Number' - } - }, - enabled: { - required: true, - serializedName: 'properties.enabled', - type: { - name: 'Boolean' - } - }, - scopes: { - required: false, - serializedName: 'properties.scopes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - evaluationFrequency: { - required: true, - serializedName: 'properties.evaluationFrequency', - type: { - name: 'TimeSpan' - } - }, - windowSize: { - required: true, - serializedName: 'properties.windowSize', - type: { - name: 'TimeSpan' - } - }, - criteria: { - required: true, - serializedName: 'properties.criteria', - type: { - name: 'Composite', - additionalProperties: { - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'ObjectElementType', - type: { - name: 'Object' - } - } - } - }, - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertCriteria' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionElementType', - type: { - name: 'Composite', - className: 'Action' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = MetricAlertResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js deleted file mode 100644 index 99a72bf055..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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'); - -/** - * Specifies the metric alert criteria for a single resource that has multiple - * metric criteria. - * - * @extends models['MetricAlertCriteria'] - */ -class MetricAlertSingleResourceMultipleMetricCriteria extends models['MetricAlertCriteria'] { - /** - * Create a MetricAlertSingleResourceMultipleMetricCriteria. - * @member {array} [allOf] The list of metric criteria for this 'all of' - * operation. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricAlertSingleResourceMultipleMetricCriteria - * - * @returns {object} metadata of MetricAlertSingleResourceMultipleMetricCriteria - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertSingleResourceMultipleMetricCriteria', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - allOf: { - required: false, - serializedName: 'allOf', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricCriteriaElementType', - type: { - name: 'Composite', - className: 'MetricCriteria' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricAlertSingleResourceMultipleMetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatus.js b/lib/services/monitor/lib/lib/models/metricAlertStatus.js deleted file mode 100644 index 6df29691be..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertStatus.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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'); - -/** - * An alert status. - * - */ -class MetricAlertStatus { - /** - * Create a MetricAlertStatus. - * @member {string} [name] The status name. - * @member {string} [id] The alert rule arm id. - * @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 {string} [properties.status] status value - * @member {date} [properties.timestamp] UTC time when the status was - * checked. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertStatus - * - * @returns {object} metadata of MetricAlertStatus - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertStatus', - type: { - name: 'Composite', - className: 'MetricAlertStatus', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'String' - } - }, - id: { - required: false, - serializedName: 'id', - type: { - name: 'String' - } - }, - type: { - required: false, - serializedName: 'type', - type: { - name: 'String' - } - }, - properties: { - required: false, - serializedName: 'properties', - type: { - name: 'Composite', - className: 'MetricAlertStatusProperties' - } - } - } - } - }; - } -} - -module.exports = MetricAlertStatus; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js b/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js deleted file mode 100644 index e3679d730b..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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'); - -/** - * Represents a collection of alert rule resources. - * - */ -class MetricAlertStatusCollection { - /** - * Create a MetricAlertStatusCollection. - * @member {array} [value] the values for the alert rule resources. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertStatusCollection - * - * @returns {object} metadata of MetricAlertStatusCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertStatusCollection', - type: { - name: 'Composite', - className: 'MetricAlertStatusCollection', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricAlertStatusElementType', - type: { - name: 'Composite', - className: 'MetricAlertStatus' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricAlertStatusCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js b/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js deleted file mode 100644 index b9581c6cda..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 status properties. - * - */ -class MetricAlertStatusProperties { - /** - * Create a MetricAlertStatusProperties. - * @member {object} [dimensions] - * @member {string} [status] status value - * @member {date} [timestamp] UTC time when the status was checked. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertStatusProperties - * - * @returns {object} metadata of MetricAlertStatusProperties - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertStatusProperties', - type: { - name: 'Composite', - className: 'MetricAlertStatusProperties', - modelProperties: { - dimensions: { - required: false, - serializedName: 'dimensions', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - status: { - required: false, - serializedName: 'status', - type: { - name: 'String' - } - }, - timestamp: { - required: false, - serializedName: 'timestamp', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = MetricAlertStatusProperties; diff --git a/lib/services/monitor/lib/lib/models/metricAvailability.js b/lib/services/monitor/lib/lib/models/metricAvailability.js deleted file mode 100644 index b8374a22c0..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAvailability.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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'; - -/** - * Metric availability specifies the time grain (aggregation interval or - * frequency) and the retention period for that time grain. - * - */ -class MetricAvailability { - /** - * Create a MetricAvailability. - * @member {moment.duration} [timeGrain] the time grain specifies the - * aggregation interval for the metric. Expressed as a duration 'PT1M', - * 'P1D', etc. - * @member {moment.duration} [retention] the retention period for the metric - * at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAvailability - * - * @returns {object} metadata of MetricAvailability - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAvailability', - type: { - name: 'Composite', - className: 'MetricAvailability', - modelProperties: { - timeGrain: { - required: false, - serializedName: 'timeGrain', - type: { - name: 'TimeSpan' - } - }, - retention: { - required: false, - serializedName: 'retention', - type: { - name: 'TimeSpan' - } - } - } - } - }; - } -} - -module.exports = MetricAvailability; diff --git a/lib/services/monitor/lib/lib/models/metricCriteria.js b/lib/services/monitor/lib/lib/models/metricCriteria.js deleted file mode 100644 index 19192dc18a..0000000000 --- a/lib/services/monitor/lib/lib/models/metricCriteria.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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'); - -/** - * Class representing a MetricCriteria. - */ -class MetricCriteria { - /** - * Create a MetricCriteria. - * @member {string} name Name of the criteria. - * @member {string} metricName Name of the metric. - * @member {string} [metricNamespace] Namespace of the metric. - * @member {object} operator the criteria operator. - * @member {object} timeAggregation the criteria time aggregation types. - * @member {number} threshold the criteria threshold value that activates the - * alert. - * @member {array} [dimensions] List of dimension conditions. - */ - constructor() { - } - - /** - * Defines the metadata of MetricCriteria - * - * @returns {object} metadata of MetricCriteria - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricCriteria', - type: { - name: 'Composite', - className: 'MetricCriteria', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - metricName: { - required: true, - serializedName: 'metricName', - type: { - name: 'String' - } - }, - metricNamespace: { - required: false, - serializedName: 'metricNamespace', - type: { - name: 'String' - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'Object' - } - }, - timeAggregation: { - required: true, - serializedName: 'timeAggregation', - type: { - name: 'Object' - } - }, - threshold: { - required: true, - serializedName: 'threshold', - type: { - name: 'Number' - } - }, - dimensions: { - required: false, - serializedName: 'dimensions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricDimensionElementType', - type: { - name: 'Composite', - className: 'MetricDimension' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricDefinition.js b/lib/services/monitor/lib/lib/models/metricDefinition.js deleted file mode 100644 index 06e73cee86..0000000000 --- a/lib/services/monitor/lib/lib/models/metricDefinition.js +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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'); - -/** - * Metric definition class specifies the metadata for a metric. - * - */ -class MetricDefinition { - /** - * Create a MetricDefinition. - * @member {boolean} [isDimensionRequired] Flag to indicate whether the - * dimension is required. - * @member {string} [resourceId] the resource identifier of the resource that - * emitted the metric. - * @member {string} [namespace] the namespace the metric blongs to. - * @member {object} [name] the name and the display name of the metric, i.e. - * it is a localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [unit] the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {string} [primaryAggregationType] the primary aggregation type - * value defining how to use the values for display. Possible values include: - * 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - * @member {array} [supportedAggregationTypes] the collection of what - * aggregation types are supported. - * @member {array} [metricAvailabilities] the collection of what aggregation - * intervals are available to be queried. - * @member {string} [id] the resource identifier of the metric definition. - * @member {array} [dimensions] the name and the display name of the - * dimension, i.e. it is a localizable string. - */ - constructor() { - } - - /** - * Defines the metadata of MetricDefinition - * - * @returns {object} metadata of MetricDefinition - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricDefinition', - type: { - name: 'Composite', - className: 'MetricDefinition', - modelProperties: { - isDimensionRequired: { - required: false, - serializedName: 'isDimensionRequired', - type: { - name: 'Boolean' - } - }, - resourceId: { - required: false, - serializedName: 'resourceId', - type: { - name: 'String' - } - }, - namespace: { - required: false, - serializedName: 'namespace', - type: { - name: 'String' - } - }, - name: { - required: false, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - unit: { - required: false, - serializedName: 'unit', - type: { - name: 'Enum', - allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] - } - }, - primaryAggregationType: { - required: false, - serializedName: 'primaryAggregationType', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] - } - }, - supportedAggregationTypes: { - required: false, - serializedName: 'supportedAggregationTypes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AggregationTypeElementType', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] - } - } - } - }, - metricAvailabilities: { - required: false, - serializedName: 'metricAvailabilities', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricAvailabilityElementType', - type: { - name: 'Composite', - className: 'MetricAvailability' - } - } - } - }, - id: { - required: false, - serializedName: 'id', - type: { - name: 'String' - } - }, - dimensions: { - required: false, - serializedName: 'dimensions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LocalizableStringElementType', - type: { - name: 'Composite', - className: 'LocalizableString' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricDefinition; diff --git a/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js b/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js deleted file mode 100644 index e6466e922a..0000000000 --- a/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 collection of metric definitions. - */ -class MetricDefinitionCollection extends Array { - /** - * Create a MetricDefinitionCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricDefinitionCollection - * - * @returns {object} metadata of MetricDefinitionCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricDefinitionCollection', - type: { - name: 'Composite', - className: 'MetricDefinitionCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricDefinitionElementType', - type: { - name: 'Composite', - className: 'MetricDefinition' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricDefinitionCollection; diff --git a/lib/services/monitor/lib/lib/models/metricDimension.js b/lib/services/monitor/lib/lib/models/metricDimension.js deleted file mode 100644 index 4805da9870..0000000000 --- a/lib/services/monitor/lib/lib/models/metricDimension.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Class representing a MetricDimension. - */ -class MetricDimension { - /** - * Create a MetricDimension. - * @member {string} name Name of the dimension. - * @member {string} operator the dimension operator. - * @member {array} values list of dimension values. - */ - constructor() { - } - - /** - * Defines the metadata of MetricDimension - * - * @returns {object} metadata of MetricDimension - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricDimension', - type: { - name: 'Composite', - className: 'MetricDimension', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'String' - } - }, - values: { - required: true, - serializedName: 'values', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricDimension; diff --git a/lib/services/monitor/lib/lib/models/metricSettings.js b/lib/services/monitor/lib/lib/models/metricSettings.js deleted file mode 100644 index bdde9809ff..0000000000 --- a/lib/services/monitor/lib/lib/models/metricSettings.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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'); - -/** - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular metric. - * - */ -class MetricSettings { - /** - * Create a MetricSettings. - * @member {moment.duration} [timeGrain] the timegrain of the metric in - * ISO8601 format. - * @member {string} [category] Name of a Diagnostic Metric category for a - * resource type this setting is applied to. To obtain the list of Diagnostic - * metric categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this category is - * enabled. - * @member {object} [retentionPolicy] the retention policy for this category. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of MetricSettings - * - * @returns {object} metadata of MetricSettings - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricSettings', - type: { - name: 'Composite', - className: 'MetricSettings', - modelProperties: { - timeGrain: { - required: false, - serializedName: 'timeGrain', - type: { - name: 'TimeSpan' - } - }, - category: { - required: false, - serializedName: 'category', - type: { - name: 'String' - } - }, - enabled: { - required: true, - serializedName: 'enabled', - type: { - name: 'Boolean' - } - }, - retentionPolicy: { - required: false, - serializedName: 'retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = MetricSettings; diff --git a/lib/services/monitor/lib/lib/models/metricTrigger.js b/lib/services/monitor/lib/lib/models/metricTrigger.js deleted file mode 100644 index 09e76603e5..0000000000 --- a/lib/services/monitor/lib/lib/models/metricTrigger.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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 trigger that results in a scaling action. - * - */ -class MetricTrigger { - /** - * Create a MetricTrigger. - * @member {string} metricName the name of the metric that defines what the - * rule monitors. - * @member {string} metricResourceUri the resource identifier of the resource - * the rule monitors. - * @member {moment.duration} timeGrain the granularity of metrics the rule - * monitors. Must be one of the predefined values returned from metric - * definitions for the metric. Must be between 12 hours and 1 minute. - * @member {string} statistic the metric statistic type. How the metrics from - * multiple instances are combined. Possible values include: 'Average', - * 'Min', 'Max', 'Sum' - * @member {moment.duration} timeWindow the range of time in which instance - * data is collected. This value must be greater than the delay in metric - * collection, which can vary from resource-to-resource. Must be between 12 - * hours and 5 minutes. - * @member {string} timeAggregation time aggregation type. How the data that - * is collected should be combined over time. The default value is Average. - * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' - * @member {string} operator the operator that is used to compare the metric - * data and the threshold. Possible values include: 'Equals', 'NotEquals', - * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold of the metric that triggers the - * scale action. - */ - constructor() { - } - - /** - * Defines the metadata of MetricTrigger - * - * @returns {object} metadata of MetricTrigger - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricTrigger', - type: { - name: 'Composite', - className: 'MetricTrigger', - modelProperties: { - metricName: { - required: true, - serializedName: 'metricName', - type: { - name: 'String' - } - }, - metricResourceUri: { - required: true, - serializedName: 'metricResourceUri', - type: { - name: 'String' - } - }, - timeGrain: { - required: true, - serializedName: 'timeGrain', - type: { - name: 'TimeSpan' - } - }, - statistic: { - required: true, - serializedName: 'statistic', - type: { - name: 'Enum', - allowedValues: [ 'Average', 'Min', 'Max', 'Sum' ] - } - }, - timeWindow: { - required: true, - serializedName: 'timeWindow', - type: { - name: 'TimeSpan' - } - }, - timeAggregation: { - required: true, - serializedName: 'timeAggregation', - type: { - name: 'Enum', - allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Count' ] - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'Enum', - allowedValues: [ 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] - } - }, - threshold: { - required: true, - serializedName: 'threshold', - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = MetricTrigger; diff --git a/lib/services/monitor/lib/lib/models/metricValue.js b/lib/services/monitor/lib/lib/models/metricValue.js deleted file mode 100644 index 289f6ad9b0..0000000000 --- a/lib/services/monitor/lib/lib/models/metricValue.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 metric value. - * - */ -class MetricValue { - /** - * Create a MetricValue. - * @member {date} timeStamp the timestamp for the metric value in ISO 8601 - * format. - * @member {number} [average] the average value in the time range. - * @member {number} [minimum] the least value in the time range. - * @member {number} [maximum] the greatest value in the time range. - * @member {number} [total] the sum of all of the values in the time range. - * @member {number} [count] the number of samples in the time range. Can be - * used to determine the number of values that contributed to the average - * value. - */ - constructor() { - } - - /** - * Defines the metadata of MetricValue - * - * @returns {object} metadata of MetricValue - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricValue', - type: { - name: 'Composite', - className: 'MetricValue', - modelProperties: { - timeStamp: { - required: true, - serializedName: 'timeStamp', - type: { - name: 'DateTime' - } - }, - average: { - required: false, - serializedName: 'average', - type: { - name: 'Number' - } - }, - minimum: { - required: false, - serializedName: 'minimum', - type: { - name: 'Number' - } - }, - maximum: { - required: false, - serializedName: 'maximum', - type: { - name: 'Number' - } - }, - total: { - required: false, - serializedName: 'total', - type: { - name: 'Number' - } - }, - count: { - required: false, - serializedName: 'count', - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = MetricValue; diff --git a/lib/services/monitor/lib/lib/models/operation.js b/lib/services/monitor/lib/lib/models/operation.js deleted file mode 100644 index 83a27ddcc0..0000000000 --- a/lib/services/monitor/lib/lib/models/operation.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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'); - -/** - * Microsoft Insights API operation definition. - * - */ -class Operation { - /** - * Create a Operation. - * @member {string} [name] Operation name: {provider}/{resource}/{operation} - * @member {object} [display] Display metadata associated with the operation. - * @member {string} [display.provider] Service provider: Microsoft.Insights - * @member {string} [display.resource] Resource on which the operation is - * performed: AlertRules, Autoscale, etc. - * @member {string} [display.operation] Operation type: Read, write, delete, - * etc. - */ - constructor() { - } - - /** - * Defines the metadata of Operation - * - * @returns {object} metadata of Operation - * - */ - mapper() { - return { - required: false, - serializedName: 'Operation', - type: { - name: 'Composite', - className: 'Operation', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'String' - } - }, - display: { - required: false, - serializedName: 'display', - type: { - name: 'Composite', - className: 'OperationDisplay' - } - } - } - } - }; - } -} - -module.exports = Operation; diff --git a/lib/services/monitor/lib/lib/models/operationDisplay.js b/lib/services/monitor/lib/lib/models/operationDisplay.js deleted file mode 100644 index 8e414a0a13..0000000000 --- a/lib/services/monitor/lib/lib/models/operationDisplay.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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'; - -/** - * Display metadata associated with the operation. - * - */ -class OperationDisplay { - /** - * Create a OperationDisplay. - * @member {string} [provider] Service provider: Microsoft.Insights - * @member {string} [resource] Resource on which the operation is performed: - * AlertRules, Autoscale, etc. - * @member {string} [operation] Operation type: Read, write, delete, etc. - */ - constructor() { - } - - /** - * Defines the metadata of OperationDisplay - * - * @returns {object} metadata of OperationDisplay - * - */ - mapper() { - return { - required: false, - serializedName: 'Operation_display', - type: { - name: 'Composite', - className: 'OperationDisplay', - modelProperties: { - provider: { - required: false, - serializedName: 'provider', - type: { - name: 'String' - } - }, - resource: { - required: false, - serializedName: 'resource', - type: { - name: 'String' - } - }, - operation: { - required: false, - serializedName: 'operation', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = OperationDisplay; diff --git a/lib/services/monitor/lib/lib/models/operationListResult.js b/lib/services/monitor/lib/lib/models/operationListResult.js deleted file mode 100644 index cad3161962..0000000000 --- a/lib/services/monitor/lib/lib/models/operationListResult.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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'); - -/** - * Result of the request to list Microsoft.Insights operations. It contains a - * list of operations and a URL link to get the next set of results. - * - */ -class OperationListResult { - /** - * Create a OperationListResult. - * @member {array} [value] List of operations supported by the - * Microsoft.Insights provider. - * @member {string} [nextLink] URL to get the next set of operation list - * results if there are any. - */ - constructor() { - } - - /** - * Defines the metadata of OperationListResult - * - * @returns {object} metadata of OperationListResult - * - */ - mapper() { - return { - required: false, - serializedName: 'OperationListResult', - type: { - name: 'Composite', - className: 'OperationListResult', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'OperationElementType', - type: { - name: 'Composite', - className: 'Operation' - } - } - } - }, - nextLink: { - required: false, - serializedName: 'nextLink', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = OperationListResult; diff --git a/lib/services/monitor/lib/lib/models/proxyOnlyResource.js b/lib/services/monitor/lib/lib/models/proxyOnlyResource.js deleted file mode 100644 index 768abba9af..0000000000 --- a/lib/services/monitor/lib/lib/models/proxyOnlyResource.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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'); - -/** - * A proxy only azure resource object - * - * @extends models['BaseResource'] - */ -class ProxyOnlyResource extends models['BaseResource'] { - /** - * Create a ProxyOnlyResource. - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ProxyOnlyResource - * - * @returns {object} metadata of ProxyOnlyResource - * - */ - mapper() { - return { - required: false, - serializedName: 'ProxyOnlyResource', - type: { - name: 'Composite', - className: 'ProxyOnlyResource', - 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' - } - } - } - } - }; - } -} - -module.exports = ProxyOnlyResource; diff --git a/lib/services/monitor/lib/lib/models/recurrence.js b/lib/services/monitor/lib/lib/models/recurrence.js deleted file mode 100644 index cb2dddd1d5..0000000000 --- a/lib/services/monitor/lib/lib/models/recurrence.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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 repeating times at which this profile begins. This element is not used - * if the FixedDate element is used. - * - */ -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 - * profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard - * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada - * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US - * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - * Atlantic Standard Time, Central Brazilian Standard Time, SA Western - * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. - * South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [schedule.days] the collection of days that the profile - * takes effect on. Possible values are Sunday through Saturday. - * @member {array} [schedule.hours] A collection of hours that the profile - * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - * times are not supported). - * @member {array} [schedule.minutes] A collection of minutes at which the - * profile takes effect at. - */ - constructor() { - } - - /** - * Defines the metadata of Recurrence - * - * @returns {object} metadata of Recurrence - * - */ - mapper() { - return { - required: false, - serializedName: 'Recurrence', - type: { - name: 'Composite', - className: 'Recurrence', - modelProperties: { - frequency: { - required: true, - serializedName: 'frequency', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ] - } - }, - schedule: { - required: true, - serializedName: 'schedule', - type: { - name: 'Composite', - className: 'RecurrentSchedule' - } - } - } - } - }; - } -} - -module.exports = Recurrence; diff --git a/lib/services/monitor/lib/lib/models/recurrentSchedule.js b/lib/services/monitor/lib/lib/models/recurrentSchedule.js deleted file mode 100644 index dec886f658..0000000000 --- a/lib/services/monitor/lib/lib/models/recurrentSchedule.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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 scheduling constraints for when the profile begins. - * - */ -class RecurrentSchedule { - /** - * Create a RecurrentSchedule. - * @member {string} timeZone the timezone for the hours of the profile. Some - * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian - * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), - * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time - * (Mexico), Mountain Standard Time, Central America Standard Time, Central - * Standard Time, Central Standard Time (Mexico), Canada Central Standard - * Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard - * Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard - * Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific - * SA Standard Time, Newfoundland Standard Time, E. South America Standard - * Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard - * Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard - * Time, W. Europe Standard Time, Central Europe Standard Time, Romance - * Standard Time, Central European Standard Time, W. Central Africa Standard - * Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, - * Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. - * Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} days the collection of days that the profile takes effect - * on. Possible values are Sunday through Saturday. - * @member {array} hours A collection of hours that the profile takes effect - * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not - * supported). - * @member {array} minutes A collection of minutes at which the profile takes - * effect at. - */ - constructor() { - } - - /** - * Defines the metadata of RecurrentSchedule - * - * @returns {object} metadata of RecurrentSchedule - * - */ - mapper() { - return { - required: false, - serializedName: 'RecurrentSchedule', - type: { - name: 'Composite', - className: 'RecurrentSchedule', - modelProperties: { - timeZone: { - required: true, - serializedName: 'timeZone', - type: { - name: 'String' - } - }, - days: { - required: true, - serializedName: 'days', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - hours: { - required: true, - serializedName: 'hours', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - }, - minutes: { - required: true, - serializedName: 'minutes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - } - } - } - }; - } -} - -module.exports = RecurrentSchedule; diff --git a/lib/services/monitor/lib/lib/models/resource.js b/lib/services/monitor/lib/lib/models/resource.js deleted file mode 100644 index 429ae3a958..0000000000 --- a/lib/services/monitor/lib/lib/models/resource.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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'); - -/** - * An azure resource object - * - * @extends models['BaseResource'] - */ -class Resource extends models['BaseResource'] { - /** - * Create a Resource. - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - * @member {string} location Resource location - * @member {object} [tags] Resource tags - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Resource - * - * @returns {object} metadata of Resource - * - */ - mapper() { - return { - required: false, - serializedName: 'Resource', - type: { - name: 'Composite', - className: 'Resource', - 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' - } - } - } - } - } - } - }; - } -} - -module.exports = Resource; diff --git a/lib/services/monitor/lib/lib/models/response.js b/lib/services/monitor/lib/lib/models/response.js deleted file mode 100644 index 20e0c9cbb3..0000000000 --- a/lib/services/monitor/lib/lib/models/response.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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 response to a metrics query. - * - */ -class Response { - /** - * Create a Response. - * @member {number} [cost] The integer value representing the cost of the - * query, for data case. - * @member {string} timespan The timespan for which the data was retrieved. - * Its value consists of two datatimes concatenated, separated by '/'. This - * may be adjusted in the future and returned back from what was originally - * requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if - * a metadata request was made. - * @member {string} [namespace] The namespace of the metrics been queried - * @member {string} [resourceregion] The region of the resource been queried - * for metrics. - * @member {array} value the value of the collection. - */ - constructor() { - } - - /** - * Defines the metadata of Response - * - * @returns {object} metadata of Response - * - */ - mapper() { - return { - required: false, - serializedName: 'Response', - type: { - name: 'Composite', - className: 'Response', - modelProperties: { - cost: { - required: false, - serializedName: 'cost', - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: 'Number' - } - }, - timespan: { - required: true, - serializedName: 'timespan', - type: { - name: 'String' - } - }, - interval: { - required: false, - serializedName: 'interval', - type: { - name: 'TimeSpan' - } - }, - namespace: { - required: false, - serializedName: 'namespace', - type: { - name: 'String' - } - }, - resourceregion: { - required: false, - serializedName: 'resourceregion', - type: { - name: 'String' - } - }, - value: { - required: true, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricElementType', - type: { - name: 'Composite', - className: 'Metric' - } - } - } - } - } - } - }; - } -} - -module.exports = Response; diff --git a/lib/services/monitor/lib/lib/models/retentionPolicy.js b/lib/services/monitor/lib/lib/models/retentionPolicy.js deleted file mode 100644 index 1ae39bed86..0000000000 --- a/lib/services/monitor/lib/lib/models/retentionPolicy.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 retention policy for the log. - * - */ -class RetentionPolicy { - /** - * Create a RetentionPolicy. - * @member {boolean} enabled a value indicating whether the retention policy - * is enabled. - * @member {number} days the number of days for the retention in days. A - * value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of RetentionPolicy - * - * @returns {object} metadata of RetentionPolicy - * - */ - mapper() { - return { - required: false, - serializedName: 'RetentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy', - modelProperties: { - enabled: { - required: true, - serializedName: 'enabled', - type: { - name: 'Boolean' - } - }, - days: { - required: true, - serializedName: 'days', - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = RetentionPolicy; diff --git a/lib/services/monitor/lib/lib/models/ruleAction.js b/lib/services/monitor/lib/lib/models/ruleAction.js deleted file mode 100644 index 8cc7f75b03..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleAction.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 action that is performed when the alert rule becomes active, and when an - * alert condition is resolved. - * - */ -class RuleAction { - /** - * Create a RuleAction. - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of RuleAction - * - * @returns {object} metadata of RuleAction - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleAction', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleAction', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleAction; diff --git a/lib/services/monitor/lib/lib/models/ruleCondition.js b/lib/services/monitor/lib/lib/models/ruleCondition.js deleted file mode 100644 index 5b43f85397..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleCondition.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 alert rule being activated. - * - */ -class RuleCondition { - /** - * Create a RuleCondition. - * @member {object} [dataSource] the resource from which the rule collects - * its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [dataSource.resourceUri] the resource identifier of the - * resource the rule monitors. **NOTE**: this property cannot be updated for - * an existing rule. - * @member {string} [dataSource.odatatype] Polymorphic Discriminator - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of RuleCondition - * - * @returns {object} metadata of RuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'RuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleCondition; diff --git a/lib/services/monitor/lib/lib/models/ruleDataSource.js b/lib/services/monitor/lib/lib/models/ruleDataSource.js deleted file mode 100644 index f106206ee3..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleDataSource.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 resource from which the rule collects its data. - * - */ -class RuleDataSource { - /** - * Create a RuleDataSource. - * @member {string} [resourceUri] the resource identifier of the resource the - * rule monitors. **NOTE**: this property cannot be updated for an existing - * rule. - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of RuleDataSource - * - * @returns {object} metadata of RuleDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleDataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource', - modelProperties: { - resourceUri: { - required: false, - serializedName: 'resourceUri', - type: { - name: 'String' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleEmailAction.js b/lib/services/monitor/lib/lib/models/ruleEmailAction.js deleted file mode 100644 index 7a5a3b4e66..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleEmailAction.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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'); - -/** - * Specifies the action to send email when the rule condition is evaluated. The - * discriminator is always RuleEmailAction in this case. - * - * @extends models['RuleAction'] - */ -class RuleEmailAction extends models['RuleAction'] { - /** - * Create a RuleEmailAction. - * @member {boolean} [sendToServiceOwners] Whether the administrators - * (service and co-administrators) of the service should be notified when the - * alert is activated. - * @member {array} [customEmails] the list of administrator's custom email - * addresses to notify of the activation of the alert. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleEmailAction - * - * @returns {object} metadata of RuleEmailAction - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleEmailAction', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - sendToServiceOwners: { - required: false, - serializedName: 'sendToServiceOwners', - type: { - name: 'Boolean' - } - }, - customEmails: { - required: false, - serializedName: 'customEmails', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = RuleEmailAction; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js deleted file mode 100644 index a8a5de752c..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 claims for a rule management event data source. - * - */ -class RuleManagementEventClaimsDataSource { - /** - * Create a RuleManagementEventClaimsDataSource. - * @member {string} [emailAddress] the email address. - */ - constructor() { - } - - /** - * Defines the metadata of RuleManagementEventClaimsDataSource - * - * @returns {object} metadata of RuleManagementEventClaimsDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleManagementEventClaimsDataSource', - type: { - name: 'Composite', - className: 'RuleManagementEventClaimsDataSource', - modelProperties: { - emailAddress: { - required: false, - serializedName: 'emailAddress', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleManagementEventClaimsDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js deleted file mode 100644 index b981085f6d..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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'); - -/** - * A rule management event data source. The discriminator fields is always - * RuleManagementEventDataSource in this case. - * - * @extends models['RuleDataSource'] - */ -class RuleManagementEventDataSource extends models['RuleDataSource'] { - /** - * Create a RuleManagementEventDataSource. - * @member {string} [eventName] the event name. - * @member {string} [eventSource] the event source. - * @member {string} [level] the level. - * @member {string} [operationName] The name of the operation that should be - * checked for. If no name is provided, any operation will match. - * @member {string} [resourceGroupName] the resource group name. - * @member {string} [resourceProviderName] the resource provider name. - * @member {string} [status] The status of the operation that should be - * checked for. If no status is provided, any status will match. - * @member {string} [subStatus] the substatus. - * @member {object} [claims] the claims. - * @member {string} [claims.emailAddress] the email address. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleManagementEventDataSource - * - * @returns {object} metadata of RuleManagementEventDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleManagementEventDataSource', - modelProperties: { - resourceUri: { - required: false, - serializedName: 'resourceUri', - type: { - name: 'String' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - eventName: { - required: false, - serializedName: 'eventName', - type: { - name: 'String' - } - }, - eventSource: { - required: false, - serializedName: 'eventSource', - type: { - name: 'String' - } - }, - level: { - required: false, - serializedName: 'level', - type: { - name: 'String' - } - }, - operationName: { - required: false, - serializedName: 'operationName', - type: { - name: 'String' - } - }, - resourceGroupName: { - required: false, - serializedName: 'resourceGroupName', - type: { - name: 'String' - } - }, - resourceProviderName: { - required: false, - serializedName: 'resourceProviderName', - type: { - name: 'String' - } - }, - status: { - required: false, - serializedName: 'status', - type: { - name: 'String' - } - }, - subStatus: { - required: false, - serializedName: 'subStatus', - type: { - name: 'String' - } - }, - claims: { - required: false, - serializedName: 'claims', - type: { - name: 'Composite', - className: 'RuleManagementEventClaimsDataSource' - } - } - } - } - }; - } -} - -module.exports = RuleManagementEventDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js b/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js deleted file mode 100644 index abf2f6aae1..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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'); - -/** - * A rule metric data source. The discriminator value is always - * RuleMetricDataSource in this case. - * - * @extends models['RuleDataSource'] - */ -class RuleMetricDataSource extends models['RuleDataSource'] { - /** - * Create a RuleMetricDataSource. - * @member {string} [metricName] the name of the metric that defines what the - * rule monitors. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleMetricDataSource - * - * @returns {object} metadata of RuleMetricDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleMetricDataSource', - modelProperties: { - resourceUri: { - required: false, - serializedName: 'resourceUri', - type: { - name: 'String' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - metricName: { - required: false, - serializedName: 'metricName', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleMetricDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleWebhookAction.js b/lib/services/monitor/lib/lib/models/ruleWebhookAction.js deleted file mode 100644 index 58cf335564..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleWebhookAction.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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'); - -/** - * Specifies the action to post to service when the rule condition is - * evaluated. The discriminator is always RuleWebhookAction in this case. - * - * @extends models['RuleAction'] - */ -class RuleWebhookAction extends models['RuleAction'] { - /** - * Create a RuleWebhookAction. - * @member {string} [serviceUri] the service uri to Post the notification - * when the alert activates or resolves. - * @member {object} [properties] the dictionary of custom properties to - * include with the post operation. These data are appended to the webhook - * payload. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleWebhookAction - * - * @returns {object} metadata of RuleWebhookAction - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleWebhookAction', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - serviceUri: { - required: false, - serializedName: 'serviceUri', - type: { - name: 'String' - } - }, - properties: { - required: false, - serializedName: 'properties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = RuleWebhookAction; diff --git a/lib/services/monitor/lib/lib/models/scaleAction.js b/lib/services/monitor/lib/lib/models/scaleAction.js deleted file mode 100644 index e07a8a5d27..0000000000 --- a/lib/services/monitor/lib/lib/models/scaleAction.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 parameters for the scaling action. - * - */ -class ScaleAction { - /** - * Create a ScaleAction. - * @member {string} direction the scale direction. Whether the scaling action - * increases or decreases the number of instances. Possible values include: - * 'None', 'Increase', 'Decrease' - * @member {string} type the type of action that should occur when the scale - * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', - * 'ExactCount' - * @member {string} [value] the number of instances that are involved in the - * scaling action. This value must be 1 or greater. The default value is 1. - * Default value: '1' . - * @member {moment.duration} cooldown the amount of time to wait since the - * last scaling action before this action occurs. It must be between 1 week - * and 1 minute in ISO 8601 format. - */ - constructor() { - } - - /** - * Defines the metadata of ScaleAction - * - * @returns {object} metadata of ScaleAction - * - */ - mapper() { - return { - required: false, - serializedName: 'ScaleAction', - type: { - name: 'Composite', - className: 'ScaleAction', - modelProperties: { - direction: { - required: true, - serializedName: 'direction', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Increase', 'Decrease' ] - } - }, - type: { - required: true, - serializedName: 'type', - type: { - name: 'Enum', - allowedValues: [ 'ChangeCount', 'PercentChangeCount', 'ExactCount' ] - } - }, - value: { - required: false, - serializedName: 'value', - defaultValue: '1', - type: { - name: 'String' - } - }, - cooldown: { - required: true, - serializedName: 'cooldown', - type: { - name: 'TimeSpan' - } - } - } - } - }; - } -} - -module.exports = ScaleAction; diff --git a/lib/services/monitor/lib/lib/models/scaleCapacity.js b/lib/services/monitor/lib/lib/models/scaleCapacity.js deleted file mode 100644 index 841ec3393c..0000000000 --- a/lib/services/monitor/lib/lib/models/scaleCapacity.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 number of instances that can be used during this profile. - * - */ -class ScaleCapacity { - /** - * Create a ScaleCapacity. - * @member {string} minimum the minimum number of instances for the resource. - * @member {string} maximum the maximum number of instances for the resource. - * The actual maximum number of instances is limited by the cores that are - * available in the subscription. - * @member {string} default the number of instances that will be set if - * metrics are not available for evaluation. The default is only used if the - * current instance count is lower than the default. - */ - constructor() { - } - - /** - * Defines the metadata of ScaleCapacity - * - * @returns {object} metadata of ScaleCapacity - * - */ - mapper() { - return { - required: false, - serializedName: 'ScaleCapacity', - type: { - name: 'Composite', - className: 'ScaleCapacity', - modelProperties: { - minimum: { - required: true, - serializedName: 'minimum', - type: { - name: 'String' - } - }, - maximum: { - required: true, - serializedName: 'maximum', - type: { - name: 'String' - } - }, - default: { - required: true, - serializedName: 'default', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ScaleCapacity; diff --git a/lib/services/monitor/lib/lib/models/scaleRule.js b/lib/services/monitor/lib/lib/models/scaleRule.js deleted file mode 100644 index 0836d498c2..0000000000 --- a/lib/services/monitor/lib/lib/models/scaleRule.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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'); - -/** - * A rule that provide the triggers and parameters for the scaling action. - * - */ -class ScaleRule { - /** - * Create a ScaleRule. - * @member {object} metricTrigger the trigger that results in a scaling - * action. - * @member {string} [metricTrigger.metricName] the name of the metric that - * defines what the rule monitors. - * @member {string} [metricTrigger.metricResourceUri] the resource identifier - * of the resource the rule monitors. - * @member {moment.duration} [metricTrigger.timeGrain] the granularity of - * metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [metricTrigger.statistic] the metric statistic type. How - * the metrics from multiple instances are combined. Possible values include: - * 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [metricTrigger.timeWindow] the range of time in - * which instance data is collected. This value must be greater than the - * delay in metric collection, which can vary from resource-to-resource. Must - * be between 12 hours and 5 minutes. - * @member {string} [metricTrigger.timeAggregation] time aggregation type. - * How the data that is collected should be combined over time. The default - * value is Average. Possible values include: 'Average', 'Minimum', - * 'Maximum', 'Total', 'Count' - * @member {string} [metricTrigger.operator] the operator that is used to - * compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [metricTrigger.threshold] the threshold of the metric - * that triggers the scale action. - * @member {object} scaleAction the parameters for the scaling action. - * @member {string} [scaleAction.direction] the scale direction. Whether the - * scaling action increases or decreases the number of instances. Possible - * values include: 'None', 'Increase', 'Decrease' - * @member {string} [scaleAction.type] the type of action that should occur - * when the scale rule fires. Possible values include: 'ChangeCount', - * 'PercentChangeCount', 'ExactCount' - * @member {string} [scaleAction.value] the number of instances that are - * involved in the scaling action. This value must be 1 or greater. The - * default value is 1. - * @member {moment.duration} [scaleAction.cooldown] the amount of time to - * wait since the last scaling action before this action occurs. It must be - * between 1 week and 1 minute in ISO 8601 format. - */ - constructor() { - } - - /** - * Defines the metadata of ScaleRule - * - * @returns {object} metadata of ScaleRule - * - */ - mapper() { - return { - required: false, - serializedName: 'ScaleRule', - type: { - name: 'Composite', - className: 'ScaleRule', - modelProperties: { - metricTrigger: { - required: true, - serializedName: 'metricTrigger', - type: { - name: 'Composite', - className: 'MetricTrigger' - } - }, - scaleAction: { - required: true, - serializedName: 'scaleAction', - type: { - name: 'Composite', - className: 'ScaleAction' - } - } - } - } - }; - } -} - -module.exports = ScaleRule; diff --git a/lib/services/monitor/lib/lib/models/senderAuthorization.js b/lib/services/monitor/lib/lib/models/senderAuthorization.js deleted file mode 100644 index db357336e2..0000000000 --- a/lib/services/monitor/lib/lib/models/senderAuthorization.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 authorization used by the user who has performed the operation that led - * to this event. This captures the RBAC properties of the event. These usually - * include the 'action', 'role' and the 'scope' - * - */ -class SenderAuthorization { - /** - * Create a SenderAuthorization. - * @member {string} [action] the permissible actions. For instance: - * microsoft.support/supporttickets/write - * @member {string} [role] the role of the user. For instance: Subscription - * Admin - * @member {string} [scope] the scope. - */ - constructor() { - } - - /** - * Defines the metadata of SenderAuthorization - * - * @returns {object} metadata of SenderAuthorization - * - */ - mapper() { - return { - required: false, - serializedName: 'SenderAuthorization', - type: { - name: 'Composite', - className: 'SenderAuthorization', - modelProperties: { - action: { - required: false, - serializedName: 'action', - type: { - name: 'String' - } - }, - role: { - required: false, - serializedName: 'role', - type: { - name: 'String' - } - }, - scope: { - required: false, - serializedName: 'scope', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = SenderAuthorization; diff --git a/lib/services/monitor/lib/lib/models/smsReceiver.js b/lib/services/monitor/lib/lib/models/smsReceiver.js deleted file mode 100644 index 9579690c9e..0000000000 --- a/lib/services/monitor/lib/lib/models/smsReceiver.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 SMS receiver. - * - */ -class SmsReceiver { - /** - * Create a SmsReceiver. - * @member {string} name The name of the SMS receiver. Names must be unique - * across all receivers within an action group. - * @member {string} countryCode The country code of the SMS receiver. - * @member {string} phoneNumber The phone number of the SMS receiver. - * @member {string} [status] The status of the receiver. Possible values - * include: 'NotSpecified', 'Enabled', 'Disabled' - */ - constructor() { - } - - /** - * Defines the metadata of SmsReceiver - * - * @returns {object} metadata of SmsReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'SmsReceiver', - type: { - name: 'Composite', - className: 'SmsReceiver', - 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' - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] - } - } - } - } - }; - } -} - -module.exports = SmsReceiver; diff --git a/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js deleted file mode 100644 index 899822bb45..0000000000 --- a/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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'); - -/** - * A rule condition based on a metric crossing a threshold. - * - * @extends models['RuleCondition'] - */ -class ThresholdRuleCondition extends models['RuleCondition'] { - /** - * Create a ThresholdRuleCondition. - * @member {string} operator the operator used to compare the data and the - * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', - * 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {string} [timeAggregation] the time aggregation operator. How the - * data that are collected should be combined over time. The default value is - * the PrimaryAggregationType of the Metric. Possible values include: - * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ThresholdRuleCondition - * - * @returns {object} metadata of ThresholdRuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'ThresholdRuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'Enum', - allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] - } - }, - threshold: { - required: true, - serializedName: 'threshold', - type: { - name: 'Number' - } - }, - windowSize: { - required: false, - serializedName: 'windowSize', - type: { - name: 'TimeSpan' - } - }, - timeAggregation: { - required: false, - serializedName: 'timeAggregation', - type: { - name: 'Enum', - allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Last' ] - } - } - } - } - }; - } -} - -module.exports = ThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesElement.js b/lib/services/monitor/lib/lib/models/timeSeriesElement.js deleted file mode 100644 index 576f5a51ab..0000000000 --- a/lib/services/monitor/lib/lib/models/timeSeriesElement.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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'); - -/** - * A time series result type. The discriminator value is always TimeSeries in - * this case. - * - */ -class TimeSeriesElement { - /** - * Create a TimeSeriesElement. - * @member {array} [metadatavalues] the metadata values returned if $filter - * was specified in the call. - * @member {array} [data] An array of data points representing the metric - * values. This is only returned if a result type of data is specified. - */ - constructor() { - } - - /** - * Defines the metadata of TimeSeriesElement - * - * @returns {object} metadata of TimeSeriesElement - * - */ - mapper() { - return { - required: false, - serializedName: 'TimeSeriesElement', - type: { - name: 'Composite', - className: 'TimeSeriesElement', - modelProperties: { - metadatavalues: { - required: false, - serializedName: 'metadatavalues', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetadataValueElementType', - type: { - name: 'Composite', - className: 'MetadataValue' - } - } - } - }, - data: { - required: false, - serializedName: 'data', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricValueElementType', - type: { - name: 'Composite', - className: 'MetricValue' - } - } - } - } - } - } - }; - } -} - -module.exports = TimeSeriesElement; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesInformation.js b/lib/services/monitor/lib/lib/models/timeSeriesInformation.js deleted file mode 100644 index f4d8ac5464..0000000000 --- a/lib/services/monitor/lib/lib/models/timeSeriesInformation.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 time series info needed for calculating the baseline. - * - */ -class TimeSeriesInformation { - /** - * Create a TimeSeriesInformation. - * @member {array} sensitivities the list of sensitivities for calculating - * the baseline. - * @member {array} values The metric values to calculate the baseline. - * @member {array} [timestamps] the array of timestamps of the baselines. - */ - constructor() { - } - - /** - * Defines the metadata of TimeSeriesInformation - * - * @returns {object} metadata of TimeSeriesInformation - * - */ - mapper() { - return { - required: false, - serializedName: 'TimeSeriesInformation', - type: { - name: 'Composite', - className: 'TimeSeriesInformation', - modelProperties: { - sensitivities: { - required: true, - serializedName: 'sensitivities', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - values: { - required: true, - serializedName: 'values', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - }, - timestamps: { - required: false, - serializedName: 'timestamps', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DateElementType', - type: { - name: 'DateTime' - } - } - } - } - } - } - }; - } -} - -module.exports = TimeSeriesInformation; diff --git a/lib/services/monitor/lib/lib/models/timeWindow.js b/lib/services/monitor/lib/lib/models/timeWindow.js deleted file mode 100644 index c072fd288a..0000000000 --- a/lib/services/monitor/lib/lib/models/timeWindow.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 specific date-time for the profile. - * - */ -class TimeWindow { - /** - * Create a TimeWindow. - * @member {string} [timeZone] the timezone of the start and end times for - * the profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard - * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada - * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US - * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - * Atlantic Standard Time, Central Brazilian Standard Time, SA Western - * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. - * South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {date} start the start time for the profile in ISO 8601 format. - * @member {date} end the end time for the profile in ISO 8601 format. - */ - constructor() { - } - - /** - * Defines the metadata of TimeWindow - * - * @returns {object} metadata of TimeWindow - * - */ - mapper() { - return { - required: false, - serializedName: 'TimeWindow', - type: { - name: 'Composite', - className: 'TimeWindow', - modelProperties: { - timeZone: { - required: false, - serializedName: 'timeZone', - type: { - name: 'String' - } - }, - start: { - required: true, - serializedName: 'start', - type: { - name: 'DateTime' - } - }, - end: { - required: true, - serializedName: 'end', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = TimeWindow; diff --git a/lib/services/monitor/lib/lib/models/webhookNotification.js b/lib/services/monitor/lib/lib/models/webhookNotification.js deleted file mode 100644 index bc05f4b1a1..0000000000 --- a/lib/services/monitor/lib/lib/models/webhookNotification.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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'; - -/** - * Webhook notification of an autoscale event. - * - */ -class WebhookNotification { - /** - * Create a WebhookNotification. - * @member {string} [serviceUri] the service address to receive the - * notification. - * @member {object} [properties] a property bag of settings. This value can - * be empty. - */ - constructor() { - } - - /** - * Defines the metadata of WebhookNotification - * - * @returns {object} metadata of WebhookNotification - * - */ - mapper() { - return { - required: false, - serializedName: 'WebhookNotification', - type: { - name: 'Composite', - className: 'WebhookNotification', - modelProperties: { - serviceUri: { - required: false, - serializedName: 'serviceUri', - type: { - name: 'String' - } - }, - properties: { - required: false, - serializedName: 'properties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = WebhookNotification; diff --git a/lib/services/monitor/lib/lib/models/webhookReceiver.js b/lib/services/monitor/lib/lib/models/webhookReceiver.js deleted file mode 100644 index bfaf7cd202..0000000000 --- a/lib/services/monitor/lib/lib/models/webhookReceiver.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 webhook receiver. - * - */ -class WebhookReceiver { - /** - * Create a WebhookReceiver. - * @member {string} name The name of the webhook receiver. Names must be - * unique across all receivers within an action group. - * @member {string} serviceUri The URI where webhooks should be sent. - */ - constructor() { - } - - /** - * Defines the metadata of WebhookReceiver - * - * @returns {object} metadata of WebhookReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'WebhookReceiver', - type: { - name: 'Composite', - className: 'WebhookReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - serviceUri: { - required: true, - serializedName: 'serviceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = WebhookReceiver; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.d.ts b/lib/services/monitor/lib/lib/monitorManagementClient.d.ts deleted file mode 100644 index 9c64e133dc..0000000000 --- a/lib/services/monitor/lib/lib/monitorManagementClient.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { ServiceClientCredentials } from 'ms-rest'; -import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; -import * as models from "./models"; -import * as operations from "./operations"; - -export default class MonitorManagementClient extends AzureServiceClient { - /** - * Initializes a new instance of the MonitorManagementClient class. - * @constructor - * - * @class - * @param {credentials} credentials - Credentials needed for the client to connect to Azure. - * - * @param {string} subscriptionId - The Azure subscription Id. - * - * @param {string} [baseUri] - The base URI of the service. - * - * @param {object} [options] - The parameter options - * - * @param {Array} [options.filters] - Filters to be added to the request pipeline - * - * @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. - * - */ - constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); - - credentials: ServiceClientCredentials; - - subscriptionId: string; - - acceptLanguage: string; - - longRunningOperationRetryTimeout: number; - - generateClientRequestId: boolean; - - // Operation groups - autoscaleSettings: operations.AutoscaleSettings; - operations: operations.Operations; - alertRuleIncidents: operations.AlertRuleIncidents; - alertRules: operations.AlertRules; - logProfiles: operations.LogProfiles; - diagnosticSettingsOperations: operations.DiagnosticSettingsOperations; - diagnosticSettingsCategoryOperations: operations.DiagnosticSettingsCategoryOperations; - actionGroups: operations.ActionGroups; - activityLogAlerts: operations.ActivityLogAlerts; - activityLogs: operations.ActivityLogs; - eventCategories: operations.EventCategories; - tenantActivityLogs: operations.TenantActivityLogs; - metricDefinitions: operations.MetricDefinitions; - metrics: operations.Metrics; - metricBaseline: operations.MetricBaseline; - metricAlerts: operations.MetricAlerts; - metricAlertsStatus: operations.MetricAlertsStatus; -} - -export { MonitorManagementClient, models as MonitorManagementModels }; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.js b/lib/services/monitor/lib/lib/monitorManagementClient.js deleted file mode 100644 index 356cd3c461..0000000000 --- a/lib/services/monitor/lib/lib/monitorManagementClient.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -const msRest = require('ms-rest'); -const msRestAzure = require('ms-rest-azure'); -const ServiceClient = msRestAzure.AzureServiceClient; - -const models = require('./models'); -const operations = require('./operations'); - - -/** Class representing a MonitorManagementClient. */ -class MonitorManagementClient extends ServiceClient { - /** - * Create a MonitorManagementClient. - * @param {credentials} credentials - Credentials needed for the client to connect to Azure. - * @param {string} subscriptionId - The Azure subscription Id. - * @param {string} [baseUri] - The base URI of the service. - * @param {object} [options] - The parameter options - * @param {Array} [options.filters] - Filters to be added to the request pipeline - * @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. - */ - constructor(credentials, subscriptionId, baseUri, options) { - if (credentials === null || credentials === undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId === null || subscriptionId === undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) options = {}; - - super(credentials, options); - - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.generateClientRequestId = true; - this.baseUri = baseUri; - if (!this.baseUri) { - this.baseUri = 'https://management.azure.com'; - } - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - let packageInfo = this.getPackageJsonInfo(__dirname); - this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { - this.generateClientRequestId = options.generateClientRequestId; - } - this.autoscaleSettings = new operations.AutoscaleSettings(this); - this.operations = new operations.Operations(this); - this.alertRuleIncidents = new operations.AlertRuleIncidents(this); - this.alertRules = new operations.AlertRules(this); - this.logProfiles = new operations.LogProfiles(this); - this.diagnosticSettingsOperations = new operations.DiagnosticSettingsOperations(this); - this.diagnosticSettingsCategoryOperations = new operations.DiagnosticSettingsCategoryOperations(this); - this.actionGroups = new operations.ActionGroups(this); - this.activityLogAlerts = new operations.ActivityLogAlerts(this); - this.activityLogs = new operations.ActivityLogs(this); - this.eventCategories = new operations.EventCategories(this); - this.tenantActivityLogs = new operations.TenantActivityLogs(this); - this.metricDefinitions = new operations.MetricDefinitions(this); - this.metrics = new operations.Metrics(this); - this.metricBaseline = new operations.MetricBaseline(this); - this.metricAlerts = new operations.MetricAlerts(this); - this.metricAlertsStatus = new operations.MetricAlertsStatus(this); - this.models = models; - msRest.addSerializationMixin(this); - } - -} - -module.exports = MonitorManagementClient; -module.exports['default'] = MonitorManagementClient; -module.exports.MonitorManagementClient = MonitorManagementClient; -module.exports.MonitorManagementModels = models; diff --git a/lib/services/monitor/lib/lib/operations/actionGroups.js b/lib/services/monitor/lib/lib/operations/actionGroups.js deleted file mode 100644 index 5c41c3e997..0000000000 --- a/lib/services/monitor/lib/lib/operations/actionGroups.js +++ /dev/null @@ -1,1810 +0,0 @@ -/* - * 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; - -/** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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 ActionGroupResource} 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, actionGroupName, actionGroup, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); - } - if (actionGroup === null || actionGroup === undefined) { - throw new Error('actionGroup cannot be null or undefined.'); - } - 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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 = '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 (actionGroup !== null && actionGroup !== undefined) { - let requestModelMapper = new client.models['ActionGroupResource']().mapper(); - requestModel = client.serialize(requestModelMapper, actionGroup, 'actionGroup'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(actionGroup, 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['ActionGroupResource']().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['ActionGroupResource']().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); - }); -} - -/** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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 ActionGroupResource} 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, actionGroupName, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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['ActionGroupResource']().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); - }); -} - -/** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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); - }); -} - -/** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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-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 (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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); - } - if (actionGroupPatch === null || actionGroupPatch === undefined) { - throw new Error('actionGroupPatch 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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 (actionGroupPatch !== null && actionGroupPatch !== undefined) { - let requestModelMapper = new client.models['ActionGroupPatchBody']().mapper(); - requestModel = client.serialize(requestModelMapper, actionGroupPatch, 'actionGroupPatch'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(actionGroupPatch, 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['ActionGroupResource']().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); - }); -} - -/** - * Get a list of all action groups in 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 ActionGroupList} 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 _listBySubscriptionId(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-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/actionGroups'; - 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['ActionGroupList']().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); - }); -} - -/** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 ActionGroupList} 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 apiVersion = '2018-03-01'; - // 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 (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/actionGroups'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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['ActionGroupList']().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); - }); -} - -/** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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 _enableReceiver(resourceGroupName, actionGroupName, receiverName, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName 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 (receiverName === null || receiverName === undefined || typeof receiverName.valueOf() !== 'string') { - throw new Error('receiverName 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); - } - let enableRequest; - if (receiverName !== null && receiverName !== undefined) { - enableRequest = new client.models['EnableRequest'](); - enableRequest.receiverName = receiverName; - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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 = 'POST'; - 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 (enableRequest !== null && enableRequest !== undefined) { - let requestModelMapper = new client.models['EnableRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, enableRequest, 'enableRequest'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(enableRequest, 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 !== 409) { - 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); - }); -} - -/** Class representing a ActionGroups. */ -class ActionGroups { - /** - * Create a ActionGroups. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._update = _update; - this._listBySubscriptionId = _listBySubscriptionId; - this._listByResourceGroup = _listByResourceGroup; - this._enableReceiver = _enableReceiver; - } - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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, actionGroupName, actionGroup, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroup, 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, actionGroupName, actionGroup, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, optionalCallback); - } - } - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, actionGroupName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, actionGroupName, options, optionalCallback); - } - } - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, actionGroupName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, actionGroupName, options, optionalCallback); - } - } - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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, actionGroupName, actionGroupPatch, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, optionalCallback); - } - } - - /** - * Get a list of all action groups in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listBySubscriptionId(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get a list of all action groups in 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 {ActionGroupList} - 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 ActionGroupList} 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. - */ - listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listBySubscriptionId(options, optionalCallback); - } - } - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActionGroupList} - 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 ActionGroupList} 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); - } - } - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiverWithHttpOperationResponse(resourceGroupName, actionGroupName, receiverName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiver(resourceGroupName, actionGroupName, receiverName, 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._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, optionalCallback); - } - } - -} - -module.exports = ActionGroups; diff --git a/lib/services/monitor/lib/lib/operations/activityLogAlerts.js b/lib/services/monitor/lib/lib/operations/activityLogAlerts.js deleted file mode 100644 index bc6417b698..0000000000 --- a/lib/services/monitor/lib/lib/operations/activityLogAlerts.js +++ /dev/null @@ -1,1543 +0,0 @@ -/* - * 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; - -/** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); - } - if (activityLogAlert === null || activityLogAlert === undefined) { - throw new Error('activityLogAlert 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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 (activityLogAlert !== null && activityLogAlert !== undefined) { - let requestModelMapper = new client.models['ActivityLogAlertResource']().mapper(); - requestModel = client.serialize(requestModelMapper, activityLogAlert, 'activityLogAlert'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(activityLogAlert, 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['ActivityLogAlertResource']().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['ActivityLogAlertResource']().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); - }); -} - -/** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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 ActivityLogAlertResource} 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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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['ActivityLogAlertResource']().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); - }); -} - -/** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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); - }); -} - -/** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); - } - if (activityLogAlertPatch === null || activityLogAlertPatch === undefined) { - throw new Error('activityLogAlertPatch 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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 (activityLogAlertPatch !== null && activityLogAlertPatch !== undefined) { - let requestModelMapper = new client.models['ActivityLogAlertPatchBody']().mapper(); - requestModel = client.serialize(requestModelMapper, activityLogAlertPatch, 'activityLogAlertPatch'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(activityLogAlertPatch, 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['ActivityLogAlertResource']().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); - }); -} - -/** - * Get a list of all activity log alerts in 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 ActivityLogAlertList} 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 _listBySubscriptionId(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 = '2017-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/activityLogAlerts'; - 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['ActivityLogAlertList']().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); - }); -} - -/** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 ActivityLogAlertList} 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 apiVersion = '2017-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 (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 (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/activityLogAlerts'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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['ActivityLogAlertList']().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 ActivityLogAlerts. */ -class ActivityLogAlerts { - /** - * Create a ActivityLogAlerts. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._update = _update; - this._listBySubscriptionId = _listBySubscriptionId; - this._listByResourceGroup = _listByResourceGroup; - } - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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, activityLogAlertName, activityLogAlert, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, optionalCallback); - } - } - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, activityLogAlertName, options, optionalCallback); - } - } - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, activityLogAlertName, options, optionalCallback); - } - } - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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, activityLogAlertName, activityLogAlertPatch, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, optionalCallback); - } - } - - /** - * Get a list of all activity log alerts in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listBySubscriptionId(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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. - */ - listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listBySubscriptionId(options, optionalCallback); - } - } - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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 = ActivityLogAlerts; diff --git a/lib/services/monitor/lib/lib/operations/activityLogs.js b/lib/services/monitor/lib/lib/operations/activityLogs.js deleted file mode 100644 index 7128d017ab..0000000000 --- a/lib/services/monitor/lib/lib/operations/activityLogs.js +++ /dev/null @@ -1,545 +0,0 @@ -/* - * 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; - -/** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; - let apiVersion = '2015-04-01'; - // Validate - try { - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); - } - if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { - throw new Error('select 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/eventtypes/management/values'; - 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 (select !== null && select !== undefined) { - queryParameters.push('$select=' + encodeURIComponent(select)); - } - 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['EventDataCollection']().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); - }); -} - -/** - * Provides the list of records from the activity logs. - * - * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 ActivityLogs. */ -class ActivityLogs { - /** - * Create a ActivityLogs. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listNext = _listNext; - } - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - - /** - * Provides the list of records from the activity logs. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Provides the list of records from the activity logs. - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listNext(nextPageLink, options, optionalCallback); - } - } - -} - -module.exports = ActivityLogs; diff --git a/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js b/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js deleted file mode 100644 index fac095135e..0000000000 --- a/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js +++ /dev/null @@ -1,500 +0,0 @@ -/* - * 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; - -/** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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 Incident} 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, incidentName, 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 (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 (incidentName === null || incidentName === undefined || typeof incidentName.valueOf() !== 'string') { - throw new Error('incidentName 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/alertrules/{ruleName}/incidents/{incidentName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); - requestUrl = requestUrl.replace('{incidentName}', encodeURIComponent(incidentName)); - 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['Incident']().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); - }); -} - -/** - * Gets a list of incidents associated to an alert 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 IncidentListResult} 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 _listByAlertRule(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 = '2016-03-01'; - // 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/alertrules/{ruleName}/incidents'; - 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) { - 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['IncidentListResult']().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 AlertRuleIncidents. */ -class AlertRuleIncidents { - /** - * Create a AlertRuleIncidents. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._listByAlertRule = _listByAlertRule; - } - - /** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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, incidentName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, ruleName, incidentName, 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 incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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 {Incident} - 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 Incident} 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, incidentName, 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, incidentName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, ruleName, incidentName, options, optionalCallback); - } - } - - /** - * Gets a list of incidents associated to an alert 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. - */ - listByAlertRuleWithHttpOperationResponse(resourceGroupName, ruleName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByAlertRule(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 a list of incidents associated to an alert 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 {IncidentListResult} - 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 IncidentListResult} 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. - */ - listByAlertRule(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._listByAlertRule(resourceGroupName, ruleName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByAlertRule(resourceGroupName, ruleName, options, optionalCallback); - } - } - -} - -module.exports = AlertRuleIncidents; diff --git a/lib/services/monitor/lib/lib/operations/alertRules.js b/lib/services/monitor/lib/lib/operations/alertRules.js deleted file mode 100644 index 3676f74c97..0000000000 --- a/lib/services/monitor/lib/lib/operations/alertRules.js +++ /dev/null @@ -1,1423 +0,0 @@ -/* - * 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 alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 AlertRuleResource} 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 = '2016-03-01'; - // 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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - 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/alertrules/{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 = '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['AlertRuleResource']().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['AlertRuleResource']().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['AlertRuleResource']().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); - }); -} - -/** - * Deletes an alert 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 = '2016-03-01'; - // 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/alertrules/{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) { - 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; - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Gets an alert 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 AlertRuleResource} 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 = '2016-03-01'; - // 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/alertrules/{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) { - 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['AlertRuleResource']().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); - }); -} - -/** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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 AlertRuleResource} 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, alertRulesResource, 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 (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 (alertRulesResource === null || alertRulesResource === undefined) { - throw new Error('alertRulesResource 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/alertrules/{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 (alertRulesResource !== null && alertRulesResource !== undefined) { - let requestModelMapper = new client.models['AlertRuleResourcePatch']().mapper(); - requestModel = client.serialize(requestModelMapper, alertRulesResource, 'alertRulesResource'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(alertRulesResource, 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['AlertRuleResource']().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['AlertRuleResource']().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); - }); -} - -/** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 _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 apiVersion = '2016-03-01'; - // 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 (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/alertrules'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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 { - /** - * Create a AlertRules. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._update = _update; - this._listByResourceGroup = _listByResourceGroup; - } - - /** - * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {AlertRuleResource} - 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 AlertRuleResource} 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); - } - } - - /** - * Deletes an alert 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 an alert 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); - } - } - - /** - * Gets an alert 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 alert 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 {AlertRuleResource} - 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 AlertRuleResource} 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); - } - } - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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, alertRulesResource, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, ruleName, alertRulesResource, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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 {AlertRuleResource} - 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 AlertRuleResource} 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, alertRulesResource, 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, alertRulesResource, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, ruleName, alertRulesResource, options, optionalCallback); - } - } - - /** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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 alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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 = AlertRules; diff --git a/lib/services/monitor/lib/lib/operations/autoscaleSettings.js b/lib/services/monitor/lib/lib/operations/autoscaleSettings.js deleted file mode 100644 index a65507da16..0000000000 --- a/lib/services/monitor/lib/lib/operations/autoscaleSettings.js +++ /dev/null @@ -1,1561 +0,0 @@ -/* - * 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; - -/** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 _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 apiVersion = '2015-04-01'; - // 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 (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/autoscalesettings'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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); - }); -} - -/** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 = '2015-04-01'; - // 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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName 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.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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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 = '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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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); - }); -} - -/** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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); - }); -} - -/** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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['AutoscaleSettingResource']().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); - }); -} - -/** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName cannot be null or undefined and it must be of type string.'); - } - if (autoscaleSettingResource === null || autoscaleSettingResource === undefined) { - throw new Error('autoscaleSettingResource 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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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 (autoscaleSettingResource !== null && autoscaleSettingResource !== undefined) { - let requestModelMapper = new client.models['AutoscaleSettingResourcePatch']().mapper(); - requestModel = client.serialize(requestModelMapper, autoscaleSettingResource, 'autoscaleSettingResource'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(autoscaleSettingResource, 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['AutoscaleSettingResource']().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 - * - * @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 _listByResourceGroupNext(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 { - /** - * Create a AutoscaleSettings. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._listByResourceGroup = _listByResourceGroup; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._update = _update; - this._listByResourceGroupNext = _listByResourceGroupNext; - } - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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); - } - } - - /** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, autoscaleSettingName, 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 autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, autoscaleSettingName, parameters, options, optionalCallback); - } - } - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, autoscaleSettingName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, autoscaleSettingName, options, optionalCallback); - } - } - - /** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, autoscaleSettingName, 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 autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, autoscaleSettingName, options, optionalCallback); - } - } - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName, autoscaleSettingResource, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, optionalCallback); - } - } - - /** - * Lists the autoscale settings for a resource group - * - * @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. - */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByResourceGroupNext(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 resource group - * - * @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. - */ - listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); - } - } - -} - -module.exports = AutoscaleSettings; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js deleted file mode 100644 index 551dd62984..0000000000 --- a/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js +++ /dev/null @@ -1,479 +0,0 @@ -/* - * 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; - -/** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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['DiagnosticSettingsCategoryResource']().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 diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 - * DiagnosticSettingsCategoryResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - 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['DiagnosticSettingsCategoryResourceCollection']().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 DiagnosticSettingsCategoryOperations. */ -class DiagnosticSettingsCategoryOperations { - /** - * Create a DiagnosticSettingsCategoryOperations. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._list = _list; - } - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceUri, name, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsCategoryResource} - 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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceUri, name, options, optionalCallback); - } - } - - /** - * Lists the diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, 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 diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsCategoryResourceCollection} - 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 - * DiagnosticSettingsCategoryResourceCollection} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = DiagnosticSettingsCategoryOperations; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js deleted file mode 100644 index be6f0864d9..0000000000 --- a/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js +++ /dev/null @@ -1,991 +0,0 @@ -/* - * 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; - -/** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 DiagnosticSettingsResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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['DiagnosticSettingsResource']().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); - }); -} - -/** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri 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 (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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['DiagnosticSettingsResource']().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['DiagnosticSettingsResource']().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 existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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); - }); -} - -/** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 DiagnosticSettingsResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - 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['DiagnosticSettingsResourceCollection']().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 DiagnosticSettingsOperations. */ -class DiagnosticSettingsOperations { - /** - * Create a DiagnosticSettingsOperations. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._list = _list; - } - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceUri, name, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceUri, name, options, optionalCallback); - } - } - - /** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, parameters, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceUri, parameters, name, 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 diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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(resourceUri, parameters, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceUri, parameters, name, options, optionalCallback); - } - } - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceUri, name, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceUri, name, options, optionalCallback); - } - } - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsResourceCollection} - 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 DiagnosticSettingsResourceCollection} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = DiagnosticSettingsOperations; diff --git a/lib/services/monitor/lib/lib/operations/eventCategories.js b/lib/services/monitor/lib/lib/operations/eventCategories.js deleted file mode 100644 index b9705aa81a..0000000000 --- a/lib/services/monitor/lib/lib/operations/eventCategories.js +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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; - -/** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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 EventCategoryCollection} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/eventcategories'; - 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['EventCategoryCollection']().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 EventCategories. */ -class EventCategories { - /** - * Create a EventCategories. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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 {EventCategoryCollection} - 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 EventCategoryCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - -} - -module.exports = EventCategories; diff --git a/lib/services/monitor/lib/lib/operations/index.d.ts b/lib/services/monitor/lib/lib/operations/index.d.ts deleted file mode 100644 index f6c6bd1a66..0000000000 --- a/lib/services/monitor/lib/lib/operations/index.d.ts +++ /dev/null @@ -1,4284 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. -*/ - -import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; -import * as moment from 'moment'; -import * as models from '../models'; - - -/** - * @class - * AutoscaleSettings - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface AutoscaleSettings { - - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - - - /** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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. - * - * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. - * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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 {AutoscaleSettingResource} - 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. - * - * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. - * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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. - * - * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. - * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, callback: ServiceCallback): void; - update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists the autoscale settings for a resource group - * - * @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. - */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the autoscale settings for a resource group - * - * @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. - */ - 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; -} - -/** - * @class - * Operations - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface Operations { - - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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 {OperationListResult} - 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. - * - * {OperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link OperationListResult} 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. - */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * AlertRuleIncidents - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface AlertRuleIncidents { - - - /** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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 {Incident} - 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. - * - * {Incident} [result] - The deserialized result object if an error did not occur. - * See {@link Incident} 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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, ruleName: string, incidentName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, ruleName: string, incidentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets a list of incidents associated to an alert 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. - */ - listByAlertRuleWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a list of incidents associated to an alert 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 {IncidentListResult} - 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. - * - * {IncidentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link IncidentListResult} 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. - */ - listByAlertRule(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAlertRule(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; - listByAlertRule(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * AlertRules - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface AlertRules { - - - /** - * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {AlertRuleResource} - 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. - * - * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. - * See {@link AlertRuleResource} 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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes an alert 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 an alert 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; - - - /** - * Gets an alert 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 alert 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 {AlertRuleResource} - 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. - * - * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. - * See {@link AlertRuleResource} 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; - - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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 {AlertRuleResource} - 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. - * - * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. - * See {@link AlertRuleResource} 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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, callback: ServiceCallback): void; - update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; -} - -/** - * @class - * LogProfiles - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface LogProfiles { - - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(logProfileName: string, callback: ServiceCallback): void; - deleteMethod(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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 {LogProfileResource} - 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. - * - * {LogProfileResource} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileResource} 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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(logProfileName: string, callback: ServiceCallback): void; - get(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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. - * - * {LogProfileResource} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileResource} 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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, callback: ServiceCallback): void; - createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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. - * - * {LogProfileResource} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileResource} 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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, callback: ServiceCallback): void; - update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * List the log profiles. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * List the log profiles. - * - * @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 {LogProfileCollection} - 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. - * - * {LogProfileCollection} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileCollection} 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. - */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DiagnosticSettingsOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface DiagnosticSettingsOperations { - - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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. - * - * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceUri: string, name: string, callback: ServiceCallback): void; - get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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. - * - * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsResource} 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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, callback: ServiceCallback): void; - createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceUri: string, name: string, callback: ServiceCallback): void; - deleteMethod(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsResourceCollection} - 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. - * - * {DiagnosticSettingsResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsResourceCollection} 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. - */ - list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DiagnosticSettingsCategoryOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface DiagnosticSettingsCategoryOperations { - - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsCategoryResource} - 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. - * - * {DiagnosticSettingsCategoryResource} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsCategoryResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceUri: string, name: string, callback: ServiceCallback): void; - get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists the diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsCategoryResourceCollection} - 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. - * - * {DiagnosticSettingsCategoryResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link - * DiagnosticSettingsCategoryResourceCollection} 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. - */ - list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActionGroups - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface ActionGroups { - - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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 {ActionGroupResource} - 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. - * - * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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 {ActionGroupResource} - 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. - * - * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupResource} 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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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 {ActionGroupResource} - 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. - * - * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, callback: ServiceCallback): void; - update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all action groups in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all action groups in 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 {ActionGroupList} - 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. - * - * {ActionGroupList} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupList} 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. - */ - listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySubscriptionId(callback: ServiceCallback): void; - listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActionGroupList} - 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. - * - * {ActionGroupList} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiverWithHttpOperationResponse(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, callback: ServiceCallback): void; - enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActivityLogAlerts - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface ActivityLogAlerts { - - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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. - * - * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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 {ActivityLogAlertResource} - 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. - * - * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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 {ActivityLogAlertResource} - 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. - * - * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, callback: ServiceCallback): void; - update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all activity log alerts in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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. - * - * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertList} 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. - */ - listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySubscriptionId(callback: ServiceCallback): void; - listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActivityLogAlertList} - 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. - * - * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActivityLogs - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface ActivityLogs { - - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Provides the list of records from the activity logs. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Provides the list of records from the activity logs. - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * EventCategories - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface EventCategories { - - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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 {EventCategoryCollection} - 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. - * - * {EventCategoryCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventCategoryCollection} 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. - */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * TenantActivityLogs - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface TenantActivityLogs { - - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * MetricDefinitions - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricDefinitions { - - - /** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {MetricDefinitionCollection} - 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. - * - * {MetricDefinitionCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricDefinitionCollection} 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. - */ - list(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Metrics - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface Metrics { - - - /** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {Response} - 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. - * - * {Response} [result] - The deserialized result object if an error did not occur. - * See {@link Response} 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. - */ - list(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * MetricBaseline - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricBaseline { - - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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 {BaselineResponse} - 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. - * - * {BaselineResponse} [result] - The deserialized result object if an error did not occur. - * See {@link BaselineResponse} 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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceUri: string, metricName: string, callback: ServiceCallback): void; - get(resourceUri: string, metricName: string, options: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * **Lists the baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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. - */ - calculateBaselineWithHttpOperationResponse(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * **Lists the baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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 {CalculateBaselineResponse} - 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. - * - * {CalculateBaselineResponse} [result] - The deserialized result object if an error did not occur. - * See {@link CalculateBaselineResponse} 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. - */ - calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, callback: ServiceCallback): void; - calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * MetricAlerts - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricAlerts { - - - /** - * Retrieve alert rule definitions in 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>; - - /** - * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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. - * - * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResourceCollection} 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; - - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {MetricAlertResourceCollection} - 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. - * - * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResourceCollection} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Retrieve an alert rule definiton. - * - * @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>; - - /** - * Retrieve an alert rule definiton. - * - * @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 {MetricAlertResource} - 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. - * - * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResource} 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; - - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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. - * - * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResource} 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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Update an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Update an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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. - * - * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResource} 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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, callback: ServiceCallback): void; - update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Delete an alert rule defitiniton. - * - * @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>; - - /** - * Delete an alert rule defitiniton. - * - * @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; -} - -/** - * @class - * MetricAlertsStatus - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricAlertsStatus { - - - /** - * Retrieve an alert rule status. - * - * @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. - */ - listWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve an alert rule status. - * - * @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 {MetricAlertStatusCollection} - 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. - * - * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertStatusCollection} 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. - */ - list(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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. - */ - listByNameWithHttpOperationResponse(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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 {MetricAlertStatusCollection} - 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. - * - * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertStatusCollection} 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. - */ - listByName(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - 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; -} diff --git a/lib/services/monitor/lib/lib/operations/index.js b/lib/services/monitor/lib/lib/operations/index.js deleted file mode 100644 index 56d8f5aa1b..0000000000 --- a/lib/services/monitor/lib/lib/operations/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -exports.AutoscaleSettings = require('./autoscaleSettings'); -exports.Operations = require('./operations'); -exports.AlertRuleIncidents = require('./alertRuleIncidents'); -exports.AlertRules = require('./alertRules'); -exports.LogProfiles = require('./logProfiles'); -exports.DiagnosticSettingsOperations = require('./diagnosticSettingsOperations'); -exports.DiagnosticSettingsCategoryOperations = require('./diagnosticSettingsCategoryOperations'); -exports.ActionGroups = require('./actionGroups'); -exports.ActivityLogAlerts = require('./activityLogAlerts'); -exports.ActivityLogs = require('./activityLogs'); -exports.EventCategories = require('./eventCategories'); -exports.TenantActivityLogs = require('./tenantActivityLogs'); -exports.MetricDefinitions = require('./metricDefinitions'); -exports.Metrics = require('./metrics'); -exports.MetricBaseline = require('./metricBaseline'); -exports.MetricAlerts = require('./metricAlerts'); -exports.MetricAlertsStatus = require('./metricAlertsStatus'); diff --git a/lib/services/monitor/lib/lib/operations/logProfiles.js b/lib/services/monitor/lib/lib/operations/logProfiles.js deleted file mode 100644 index 8c61a074e5..0000000000 --- a/lib/services/monitor/lib/lib/operations/logProfiles.js +++ /dev/null @@ -1,1319 +0,0 @@ -/* - * 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; - -/** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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) { - 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; - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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 LogProfileResource} 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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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['LogProfileResource']().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); - }); -} - -/** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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 LogProfileResource} 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(logProfileName, 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 = '2016-03-01'; - // Validate - try { - if (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName 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.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/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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 = '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['LogProfileResource']().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) { - 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['LogProfileResource']().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); - }); -} - -/** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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 LogProfileResource} 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(logProfileName, logProfilesResource, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName cannot be null or undefined and it must be of type string.'); - } - if (logProfilesResource === null || logProfilesResource === undefined) { - throw new Error('logProfilesResource 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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 (logProfilesResource !== null && logProfilesResource !== undefined) { - let requestModelMapper = new client.models['LogProfileResourcePatch']().mapper(); - requestModel = client.serialize(requestModelMapper, logProfilesResource, 'logProfilesResource'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(logProfilesResource, 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['LogProfileResource']().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 profiles. - * - * @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 LogProfileCollection} 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 _list(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/logprofiles'; - 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['LogProfileCollection']().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 LogProfiles. */ -class LogProfiles { - /** - * Create a LogProfiles. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._update = _update; - this._list = _list; - } - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(logProfileName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(logProfileName, options, optionalCallback); - } - } - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(logProfileName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(logProfileName, options, optionalCallback); - } - } - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(logProfileName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(logProfileName, parameters, options, optionalCallback); - } - } - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName, logProfilesResource, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(logProfileName, logProfilesResource, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, logProfilesResource, 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(logProfileName, logProfilesResource, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(logProfileName, logProfilesResource, options, optionalCallback); - } - } - - /** - * List the log profiles. - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(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 profiles. - * - * @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 {LogProfileCollection} - 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 LogProfileCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - -} - -module.exports = LogProfiles; diff --git a/lib/services/monitor/lib/lib/operations/metricAlerts.js b/lib/services/monitor/lib/lib/operations/metricAlerts.js deleted file mode 100644 index d8cdf644dc..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricAlerts.js +++ /dev/null @@ -1,1590 +0,0 @@ -/* - * 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; -const moment = require('moment'); - -/** - * Retrieve alert rule definitions in 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 MetricAlertResourceCollection} 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 = '2018-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.Insight/metricAlerts'; - 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['MetricAlertResourceCollection']().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); - }); -} - -/** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 MetricAlertResourceCollection} 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 apiVersion = '2018-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 (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 (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.Insight/metricAlerts'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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['MetricAlertResourceCollection']().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); - }); -} - -/** - * Retrieve an alert rule definiton. - * - * @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 MetricAlertResource} 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-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 (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.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.Insight/metricAlerts/{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 = '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['MetricAlertResource']().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); - }); -} - -/** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 MetricAlertResource} 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-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 (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.Insight/metricAlerts/{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['MetricAlertResource']().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['MetricAlertResource']().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 an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 MetricAlertResource} 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-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 (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.Insight/metricAlerts/{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['MetricAlertResourcePatch']().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['MetricAlertResource']().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); - }); -} - -/** - * Delete an alert rule defitiniton. - * - * @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-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 (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.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.Insight/metricAlerts/{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 = '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) { - 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; - - return callback(null, result, httpRequest, response); - }); -} - -/** Class representing a MetricAlerts. */ -class MetricAlerts { - /** - * Create a MetricAlerts. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._listBySubscription = _listBySubscription; - this._listByResourceGroup = _listByResourceGroup; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._update = _update; - this._deleteMethod = _deleteMethod; - } - - /** - * Retrieve alert rule definitions in 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; - }); - }); - } - - /** - * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); - } - } - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); - } - } - - /** - * Retrieve an alert rule definiton. - * - * @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; - }); - }); - } - - /** - * Retrieve an alert rule definiton. - * - * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); - } - } - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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; - }); - }); - } - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); - } - } - - /** - * Update an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); - } - } - - /** - * Delete an alert rule defitiniton. - * - * @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; - }); - }); - } - - /** - * Delete an alert rule defitiniton. - * - * @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); - } - } - -} - -module.exports = MetricAlerts; diff --git a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js deleted file mode 100644 index 7bd81a8494..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js +++ /dev/null @@ -1,505 +0,0 @@ -/* - * 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; - -/** - * Retrieve an alert rule status. - * - * @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 MetricAlertStatusCollection} 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 _list(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-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 (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.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.Insight/metricAlerts/{ruleName}/status'; - 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 = '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['MetricAlertStatusCollection']().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); - }); -} - -/** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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 MetricAlertStatusCollection} 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 _listByName(resourceGroupName, ruleName, statusName, 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-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 (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 (statusName === null || statusName === undefined || typeof statusName.valueOf() !== 'string') { - throw new Error('statusName 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.Insight/metricAlerts/{ruleName}/status/{statusName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); - requestUrl = requestUrl.replace('{statusName}', encodeURIComponent(statusName)); - 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['MetricAlertStatusCollection']().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 MetricAlertsStatus. */ -class MetricAlertsStatus { - /** - * Create a MetricAlertsStatus. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listByName = _listByName; - } - - /** - * Retrieve an alert rule status. - * - * @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. - */ - listWithHttpOperationResponse(resourceGroupName, ruleName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(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; - }); - }); - } - - /** - * Retrieve an alert rule status. - * - * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. - */ - list(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._list(resourceGroupName, ruleName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceGroupName, ruleName, options, optionalCallback); - } - } - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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. - */ - listByNameWithHttpOperationResponse(resourceGroupName, ruleName, statusName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. - */ - listByName(resourceGroupName, ruleName, statusName, 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._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByName(resourceGroupName, ruleName, statusName, options, optionalCallback); - } - } - -} - -module.exports = MetricAlertsStatus; diff --git a/lib/services/monitor/lib/lib/operations/metricBaseline.js b/lib/services/monitor/lib/lib/operations/metricBaseline.js deleted file mode 100644 index 365ca4990c..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricBaseline.js +++ /dev/null @@ -1,642 +0,0 @@ -/* - * 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; -const moment = require('moment'); - -/** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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 BaselineResponse} 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(resourceUri, metricName, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; - let interval = (options && options.interval !== undefined) ? options.interval : undefined; - let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; - let sensitivities = (options && options.sensitivities !== undefined) ? options.sensitivities : undefined; - let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; - let apiVersion = '2017-11-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (metricName === null || metricName === undefined || typeof metricName.valueOf() !== 'string') { - throw new Error('metricName cannot be null or undefined and it must be of type string.'); - } - if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { - throw new Error('timespan must be of type string.'); - } - if(interval && !moment.isDuration(interval)) { - throw new Error('interval must be of type moment.duration.'); - } - if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { - throw new Error('aggregation must be of type string.'); - } - if (sensitivities !== null && sensitivities !== undefined && typeof sensitivities.valueOf() !== 'string') { - throw new Error('sensitivities must be of type string.'); - } - if (resultType) { - let allowedValues = [ 'Data', 'Metadata' ]; - if (!allowedValues.some( function(item) { return item === resultType; })) { - throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); - } - } - 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/baseline/{metricName}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{metricName}', encodeURIComponent(metricName)); - let queryParameters = []; - if (timespan !== null && timespan !== undefined) { - queryParameters.push('timespan=' + encodeURIComponent(timespan)); - } - if (interval !== null && interval !== undefined) { - queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); - } - if (aggregation !== null && aggregation !== undefined) { - queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); - } - if (sensitivities !== null && sensitivities !== undefined) { - queryParameters.push('sensitivities=' + encodeURIComponent(sensitivities)); - } - if (resultType !== null && resultType !== undefined) { - queryParameters.push('resultType=' + encodeURIComponent(resultType)); - } - 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['BaselineResponse']().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 baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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 CalculateBaselineResponse} 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 _calculateBaseline(resourceUri, timeSeriesInformation, 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 = '2017-11-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (timeSeriesInformation === null || timeSeriesInformation === undefined) { - throw new Error('timeSeriesInformation 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/calculatebaseline'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - 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 = 'POST'; - 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 (timeSeriesInformation !== null && timeSeriesInformation !== undefined) { - let requestModelMapper = new client.models['TimeSeriesInformation']().mapper(); - requestModel = client.serialize(requestModelMapper, timeSeriesInformation, 'timeSeriesInformation'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(timeSeriesInformation, 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['CalculateBaselineResponse']().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 MetricBaseline. */ -class MetricBaseline { - /** - * Create a MetricBaseline. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._calculateBaseline = _calculateBaseline; - } - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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(resourceUri, metricName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceUri, metricName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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 {BaselineResponse} - 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 BaselineResponse} 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(resourceUri, metricName, 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(resourceUri, metricName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceUri, metricName, options, optionalCallback); - } - } - - /** - * **Lists the baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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. - */ - calculateBaselineWithHttpOperationResponse(resourceUri, timeSeriesInformation, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._calculateBaseline(resourceUri, timeSeriesInformation, 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 baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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 {CalculateBaselineResponse} - 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 CalculateBaselineResponse} 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. - */ - calculateBaseline(resourceUri, timeSeriesInformation, 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._calculateBaseline(resourceUri, timeSeriesInformation, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._calculateBaseline(resourceUri, timeSeriesInformation, options, optionalCallback); - } - } - -} - -module.exports = MetricBaseline; diff --git a/lib/services/monitor/lib/lib/operations/metricDefinitions.js b/lib/services/monitor/lib/lib/operations/metricDefinitions.js deleted file mode 100644 index f3d1817183..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricDefinitions.js +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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; - -/** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 MetricDefinitionCollection} 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 _list(resourceUri, 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 metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; - let apiVersion = '2018-01-01'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { - throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metricDefinitions'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (metricnamespace !== null && metricnamespace !== undefined) { - queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); - } - 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['MetricDefinitionCollection']().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 MetricDefinitions. */ -class MetricDefinitions { - /** - * Create a MetricDefinitions. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, 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 metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {MetricDefinitionCollection} - 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 MetricDefinitionCollection} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = MetricDefinitions; diff --git a/lib/services/monitor/lib/lib/operations/metrics.js b/lib/services/monitor/lib/lib/operations/metrics.js deleted file mode 100644 index 02d0aa5489..0000000000 --- a/lib/services/monitor/lib/lib/operations/metrics.js +++ /dev/null @@ -1,430 +0,0 @@ -/* - * 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; -const moment = require('moment'); - -/** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 Response} 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 _list(resourceUri, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; - let interval = (options && options.interval !== undefined) ? options.interval : undefined; - let metricnames = (options && options.metricnames !== undefined) ? options.metricnames : undefined; - let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; - let top = (options && options.top !== undefined) ? options.top : undefined; - let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; - let filter = (options && options.filter !== undefined) ? options.filter : undefined; - let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; - let metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; - let apiVersion = '2018-01-01'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { - throw new Error('timespan must be of type string.'); - } - if(interval && !moment.isDuration(interval)) { - throw new Error('interval must be of type moment.duration.'); - } - if (metricnames !== null && metricnames !== undefined && typeof metricnames.valueOf() !== 'string') { - throw new Error('metricnames must be of type string.'); - } - if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { - throw new Error('aggregation must be of type string.'); - } - if (top !== null && top !== undefined && typeof top !== 'number') { - throw new Error('top must be of type number.'); - } - if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { - throw new Error('orderby must be of type string.'); - } - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); - } - if (resultType) { - let allowedValues = [ 'Data', 'Metadata' ]; - if (!allowedValues.some( function(item) { return item === resultType; })) { - throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); - } - } - if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { - throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metrics'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - let queryParameters = []; - if (timespan !== null && timespan !== undefined) { - queryParameters.push('timespan=' + encodeURIComponent(timespan)); - } - if (interval !== null && interval !== undefined) { - queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); - } - if (metricnames !== null && metricnames !== undefined) { - queryParameters.push('metricnames=' + encodeURIComponent(metricnames)); - } - if (aggregation !== null && aggregation !== undefined) { - queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); - } - if (top !== null && top !== undefined) { - queryParameters.push('top=' + encodeURIComponent(top.toString())); - } - if (orderby !== null && orderby !== undefined) { - queryParameters.push('orderby=' + encodeURIComponent(orderby)); - } - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } - if (resultType !== null && resultType !== undefined) { - queryParameters.push('resultType=' + encodeURIComponent(resultType)); - } - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (metricnamespace !== null && metricnamespace !== undefined) { - queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); - } - 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['Response']().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 Metrics. */ -class Metrics { - /** - * Create a Metrics. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, 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 metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {Response} - 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 Response} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = Metrics; diff --git a/lib/services/monitor/lib/lib/operations/operations.js b/lib/services/monitor/lib/lib/operations/operations.js deleted file mode 100644 index 664c03afa7..0000000000 --- a/lib/services/monitor/lib/lib/operations/operations.js +++ /dev/null @@ -1,235 +0,0 @@ -/* - * 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; - -/** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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 OperationListResult} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/operations'; - 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['OperationListResult']().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 Operations. */ -class Operations { - /** - * Create a Operations. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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 {OperationListResult} - 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 OperationListResult} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - -} - -module.exports = Operations; diff --git a/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js b/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js deleted file mode 100644 index 7e523153c9..0000000000 --- a/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js +++ /dev/null @@ -1,565 +0,0 @@ -/* - * 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; - -/** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; - let apiVersion = '2015-04-01'; - // Validate - try { - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); - } - if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { - throw new Error('select 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('/') ? '' : '/') + 'providers/microsoft.insights/eventtypes/management/values'; - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } - if (select !== null && select !== undefined) { - queryParameters.push('$select=' + encodeURIComponent(select)); - } - 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['EventDataCollection']().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); - }); -} - -/** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 TenantActivityLogs. */ -class TenantActivityLogs { - /** - * Create a TenantActivityLogs. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listNext = _listNext; - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listNext(nextPageLink, options, optionalCallback); - } - } - -} - -module.exports = TenantActivityLogs; diff --git a/lib/services/monitor/lib/package.json b/lib/services/monitor/lib/package.json deleted file mode 100644 index 7a880c0fcf..0000000000 --- a/lib/services/monitor/lib/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "azure-arm-monitor", - "author": "Microsoft Corporation", - "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "", - "dependencies": { - "ms-rest": "^2.3.3", - "ms-rest-azure": "^2.5.5" - }, - "keywords": [ "node", "azure" ], - "license": "MIT", - "main": "./lib/monitorManagementClient.js", - "types": "./lib/monitorManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", - "repository": { - "type": "git", - "url": "https://github.com/azure/azure-sdk-for-node.git" - }, - "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" - } -} diff --git a/lib/services/monitor/package.json b/lib/services/monitor/package.json deleted file mode 100644 index e15ff886a3..0000000000 --- a/lib/services/monitor/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "azure-monitor", - "author": "Microsoft Corporation", - "contributors": [ - "Kamath, Prarthana ", - "Medhekar, Shibani ", - "Vannelli, Leo ", - "Shen, Andy ", - "Ruela, Vinicius ", - "Moussa, George ", - "McKinlay, David ", - "Kulkarni, Jagadish ", - "Calderon-Meza, Guillermo " - ], - "version": "1.0.2-preview", - "description": "Microsoft Azure Monitor Client Library for node", - "tags": [ - "azure", - "sdk" - ], - "keywords": [ - "node", - "azure" - ], - "main": "./lib/monitorClient.js", - "types": "./lib/monitorClient.d.ts", - "license": "MIT", - "dependencies": { - "ms-rest": "^2.2.2", - "ms-rest-azure": "^2.3.3", - "moment": "~2.18.1" - }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", - "repository": { - "type": "git", - "url": "git@github.com:Azure/azure-sdk-for-node.git" - }, - "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" - }, - "scripts": { - "test": "npm -s run-script jshint" - } -} \ No newline at end of file diff --git a/lib/services/monitorManagement/lib/models/actionGroupResource.js b/lib/services/monitorManagement/lib/models/actionGroupResource.js index 125c43c8e7..9a443885a8 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(); @@ -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/monitor/lib/lib/models/azureFunctionReceiver.js b/lib/services/monitorManagement/lib/models/azureFunctionReceiver.js similarity index 100% rename from lib/services/monitor/lib/lib/models/azureFunctionReceiver.js rename to lib/services/monitorManagement/lib/models/azureFunctionReceiver.js diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index 8a6ad1d65e..44807752fe 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -1303,6 +1303,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 +1381,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 +1397,9 @@ export interface ActionGroupResource extends Resource { itsmReceivers?: ItsmReceiver[]; azureAppPushReceivers?: AzureAppPushReceiver[]; automationRunbookReceivers?: AutomationRunbookReceiver[]; + voiceReceivers?: VoiceReceiver[]; + logicAppReceivers?: LogicAppReceiver[]; + azureFunctionReceivers?: AzureFunctionReceiver[]; } /** diff --git a/lib/services/monitorManagement/lib/models/index.js b/lib/services/monitorManagement/lib/models/index.js index ebcc3e656b..878adabbd3 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'); diff --git a/lib/services/monitor/lib/lib/models/logicAppReceiver.js b/lib/services/monitorManagement/lib/models/logicAppReceiver.js similarity index 100% rename from lib/services/monitor/lib/lib/models/logicAppReceiver.js rename to lib/services/monitorManagement/lib/models/logicAppReceiver.js diff --git a/lib/services/monitor/lib/lib/models/voiceReceiver.js b/lib/services/monitorManagement/lib/models/voiceReceiver.js similarity index 100% rename from lib/services/monitor/lib/lib/models/voiceReceiver.js rename to lib/services/monitorManagement/lib/models/voiceReceiver.js diff --git a/lib/services/monitorManagement/lib/operations/actionGroups.js b/lib/services/monitorManagement/lib/operations/actionGroups.js index ec5e0913c4..5c41c3e997 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') { @@ -971,7 +980,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 +1146,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 +1219,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 diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index e3c9bb1680..f6c6bd1a66 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -1941,6 +1941,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 +2002,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 diff --git a/lib/services/monitorManagement/package.json b/lib/services/monitorManagement/package.json index e43790e469..936bbdcc65 100644 --- a/lib/services/monitorManagement/package.json +++ b/lib/services/monitorManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-monitor", "author": "Microsoft Corporation", "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "2.0.0-preview", + "version": "2.1.0-preview", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" From f5e0ed021637b641cace718416053f199cb8a634 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 29 Mar 2018 16:02:18 -0700 Subject: [PATCH 03/14] Generated from c0dafa4e20ee8bc21794994a101a4ef56ac639d5 (#2607) fix 2 more tags --- lib/services/monitor/lib/LICENSE.txt | 21 + lib/services/monitor/lib/lib/models/action.js | 67 + .../monitor/lib/lib/models/actionGroupList.js | 61 + .../lib/lib/models/actionGroupPatchBody.js | 70 + .../lib/lib/models/actionGroupResource.js | 269 ++ .../lib/models/activityLogAlertActionGroup.js | 70 + .../lib/models/activityLogAlertActionList.js | 62 + .../models/activityLogAlertAllOfCondition.js | 63 + .../models/activityLogAlertLeafCondition.js | 66 + .../lib/lib/models/activityLogAlertList.js | 61 + .../lib/models/activityLogAlertPatchBody.js | 70 + .../lib/models/activityLogAlertResource.js | 153 + .../lib/lib/models/alertRuleResource.js | 175 + .../lib/models/alertRuleResourceCollection.js | 59 + .../lib/lib/models/alertRuleResourcePatch.js | 143 + .../lib/models/automationRunbookReceiver.js | 95 + .../lib/lib/models/autoscaleNotification.js | 86 + .../lib/lib/models/autoscaleProfile.js | 204 + .../lib/models/autoscaleSettingResource.js | 159 + .../autoscaleSettingResourceCollection.js | 67 + .../models/autoscaleSettingResourcePatch.js | 126 + .../lib/lib/models/azureAppPushReceiver.js | 62 + .../lib/lib/models/azureFunctionReceiver.js | 79 + .../monitor/lib/lib/models/baseline.js | 84 + .../lib/lib/models/baselineMetadataValue.js | 65 + .../lib/lib/models/baselineResponse.js | 154 + .../lib/models/calculateBaselineResponse.js | 85 + .../diagnosticSettingsCategoryResource.js | 82 + ...osticSettingsCategoryResourceCollection.js | 63 + .../lib/models/diagnosticSettingsResource.js | 142 + .../diagnosticSettingsResourceCollection.js | 62 + .../lib/lib/models/emailNotification.js | 78 + .../monitor/lib/lib/models/emailReceiver.js | 72 + .../monitor/lib/lib/models/enableRequest.js | 52 + .../monitor/lib/lib/models/errorResponse.js | 61 + .../lib/lib/models/eventCategoryCollection.js | 60 + .../monitor/lib/lib/models/eventData.js | 342 ++ .../lib/lib/models/eventDataCollection.js | 68 + .../monitor/lib/lib/models/httpRequestInfo.js | 76 + .../monitor/lib/lib/models/incident.js | 93 + .../lib/lib/models/incidentListResult.js | 59 + .../monitor/lib/lib/models/index.d.ts | 2298 +++++++++ lib/services/monitor/lib/lib/models/index.js | 131 + .../monitor/lib/lib/models/itsmReceiver.js | 89 + .../lib/lib/models/localizableString.js | 60 + .../models/locationThresholdRuleCondition.js | 96 + .../lib/lib/models/logProfileCollection.js | 59 + .../lib/lib/models/logProfileResource.js | 161 + .../lib/lib/models/logProfileResourcePatch.js | 129 + .../monitor/lib/lib/models/logSettings.js | 79 + .../lib/lib/models/logicAppReceiver.js | 70 + .../managementEventAggregationCondition.js | 73 + .../models/managementEventRuleCondition.js | 94 + .../monitor/lib/lib/models/metadataValue.js | 65 + lib/services/monitor/lib/lib/models/metric.js | 102 + .../lib/lib/models/metricAlertCriteria.js | 70 + .../lib/lib/models/metricAlertResource.js | 208 + .../models/metricAlertResourceCollection.js | 59 + .../lib/models/metricAlertResourcePatch.js | 176 + ...ertSingleResourceMultipleMetricCriteria.js | 79 + .../lib/lib/models/metricAlertStatus.js | 84 + .../lib/models/metricAlertStatusCollection.js | 62 + .../lib/models/metricAlertStatusProperties.js | 75 + .../lib/lib/models/metricAvailability.js | 64 + .../monitor/lib/lib/models/metricCriteria.js | 110 + .../lib/lib/models/metricDefinition.js | 165 + .../lib/models/metricDefinitionCollection.js | 59 + .../monitor/lib/lib/models/metricDimension.js | 74 + .../monitor/lib/lib/models/metricSettings.js | 89 + .../monitor/lib/lib/models/metricTrigger.js | 125 + .../monitor/lib/lib/models/metricValue.js | 95 + .../monitor/lib/lib/models/operation.js | 68 + .../lib/lib/models/operationDisplay.js | 69 + .../lib/lib/models/operationListResult.js | 73 + .../lib/lib/models/proxyOnlyResource.js | 75 + .../monitor/lib/lib/models/recurrence.js | 114 + .../lib/lib/models/recurrentSchedule.js | 138 + .../monitor/lib/lib/models/resource.js | 98 + .../monitor/lib/lib/models/response.js | 113 + .../monitor/lib/lib/models/retentionPolicy.js | 65 + .../monitor/lib/lib/models/ruleAction.js | 59 + .../monitor/lib/lib/models/ruleCondition.js | 80 + .../monitor/lib/lib/models/ruleDataSource.js | 68 + .../monitor/lib/lib/models/ruleEmailAction.js | 88 + .../ruleManagementEventClaimsDataSource.js | 52 + .../models/ruleManagementEventDataSource.js | 145 + .../lib/lib/models/ruleMetricDataSource.js | 78 + .../lib/lib/models/ruleWebhookAction.js | 88 + .../monitor/lib/lib/models/scaleAction.js | 87 + .../monitor/lib/lib/models/scaleCapacity.js | 72 + .../monitor/lib/lib/models/scaleRule.js | 102 + .../lib/lib/models/senderAuthorization.js | 72 + .../monitor/lib/lib/models/smsReceiver.js | 80 + .../lib/lib/models/thresholdRuleCondition.js | 115 + .../lib/lib/models/timeSeriesElement.js | 81 + .../lib/lib/models/timeSeriesInformation.js | 90 + .../monitor/lib/lib/models/timeWindow.js | 105 + .../monitor/lib/lib/models/voiceReceiver.js | 69 + .../lib/lib/models/webhookNotification.js | 69 + .../monitor/lib/lib/models/webhookReceiver.js | 61 + .../lib/lib/monitorManagementClient.d.ts | 76 + .../lib/lib/monitorManagementClient.js | 100 + .../lib/lib/operations/actionGroups.js | 1810 +++++++ .../lib/lib/operations/activityLogAlerts.js | 1543 ++++++ .../lib/lib/operations/activityLogs.js | 545 +++ .../lib/lib/operations/alertRuleIncidents.js | 500 ++ .../monitor/lib/lib/operations/alertRules.js | 1423 ++++++ .../lib/lib/operations/autoscaleSettings.js | 1561 ++++++ .../diagnosticSettingsCategoryOperations.js | 479 ++ .../diagnosticSettingsOperations.js | 991 ++++ .../lib/lib/operations/eventCategories.js | 244 + .../monitor/lib/lib/operations/index.d.ts | 4284 +++++++++++++++++ .../monitor/lib/lib/operations/index.js | 33 + .../monitor/lib/lib/operations/logProfiles.js | 1319 +++++ .../lib/lib/operations/metricAlerts.js | 1590 ++++++ .../lib/lib/operations/metricAlertsStatus.js | 505 ++ .../lib/lib/operations/metricBaseline.js | 642 +++ .../lib/lib/operations/metricDefinitions.js | 264 + .../monitor/lib/lib/operations/metrics.js | 430 ++ .../monitor/lib/lib/operations/operations.js | 235 + .../lib/lib/operations/tenantActivityLogs.js | 565 +++ lib/services/monitor/lib/package.json | 22 + 122 files changed, 30721 insertions(+) create mode 100644 lib/services/monitor/lib/LICENSE.txt create mode 100644 lib/services/monitor/lib/lib/models/action.js create mode 100644 lib/services/monitor/lib/lib/models/actionGroupList.js create mode 100644 lib/services/monitor/lib/lib/models/actionGroupPatchBody.js create mode 100644 lib/services/monitor/lib/lib/models/actionGroupResource.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionList.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertList.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js create mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertResource.js create mode 100644 lib/services/monitor/lib/lib/models/alertRuleResource.js create mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/automationRunbookReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleNotification.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleProfile.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResource.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/azureAppPushReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/azureFunctionReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/baseline.js create mode 100644 lib/services/monitor/lib/lib/models/baselineMetadataValue.js create mode 100644 lib/services/monitor/lib/lib/models/baselineResponse.js create mode 100644 lib/services/monitor/lib/lib/models/calculateBaselineResponse.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js create mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/emailNotification.js create mode 100644 lib/services/monitor/lib/lib/models/emailReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/enableRequest.js create mode 100644 lib/services/monitor/lib/lib/models/errorResponse.js create mode 100644 lib/services/monitor/lib/lib/models/eventCategoryCollection.js create mode 100644 lib/services/monitor/lib/lib/models/eventData.js create mode 100644 lib/services/monitor/lib/lib/models/eventDataCollection.js create mode 100644 lib/services/monitor/lib/lib/models/httpRequestInfo.js create mode 100644 lib/services/monitor/lib/lib/models/incident.js create mode 100644 lib/services/monitor/lib/lib/models/incidentListResult.js create mode 100644 lib/services/monitor/lib/lib/models/index.d.ts create mode 100644 lib/services/monitor/lib/lib/models/index.js create mode 100644 lib/services/monitor/lib/lib/models/itsmReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/localizableString.js create mode 100644 lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/logProfileCollection.js create mode 100644 lib/services/monitor/lib/lib/models/logProfileResource.js create mode 100644 lib/services/monitor/lib/lib/models/logProfileResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/logSettings.js create mode 100644 lib/services/monitor/lib/lib/models/logicAppReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js create mode 100644 lib/services/monitor/lib/lib/models/managementEventRuleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/metadataValue.js create mode 100644 lib/services/monitor/lib/lib/models/metric.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertCriteria.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertResource.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatus.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js create mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js create mode 100644 lib/services/monitor/lib/lib/models/metricAvailability.js create mode 100644 lib/services/monitor/lib/lib/models/metricCriteria.js create mode 100644 lib/services/monitor/lib/lib/models/metricDefinition.js create mode 100644 lib/services/monitor/lib/lib/models/metricDefinitionCollection.js create mode 100644 lib/services/monitor/lib/lib/models/metricDimension.js create mode 100644 lib/services/monitor/lib/lib/models/metricSettings.js create mode 100644 lib/services/monitor/lib/lib/models/metricTrigger.js create mode 100644 lib/services/monitor/lib/lib/models/metricValue.js create mode 100644 lib/services/monitor/lib/lib/models/operation.js create mode 100644 lib/services/monitor/lib/lib/models/operationDisplay.js create mode 100644 lib/services/monitor/lib/lib/models/operationListResult.js create mode 100644 lib/services/monitor/lib/lib/models/proxyOnlyResource.js create mode 100644 lib/services/monitor/lib/lib/models/recurrence.js create mode 100644 lib/services/monitor/lib/lib/models/recurrentSchedule.js create mode 100644 lib/services/monitor/lib/lib/models/resource.js create mode 100644 lib/services/monitor/lib/lib/models/response.js create mode 100644 lib/services/monitor/lib/lib/models/retentionPolicy.js create mode 100644 lib/services/monitor/lib/lib/models/ruleAction.js create mode 100644 lib/services/monitor/lib/lib/models/ruleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/ruleDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleEmailAction.js create mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleMetricDataSource.js create mode 100644 lib/services/monitor/lib/lib/models/ruleWebhookAction.js create mode 100644 lib/services/monitor/lib/lib/models/scaleAction.js create mode 100644 lib/services/monitor/lib/lib/models/scaleCapacity.js create mode 100644 lib/services/monitor/lib/lib/models/scaleRule.js create mode 100644 lib/services/monitor/lib/lib/models/senderAuthorization.js create mode 100644 lib/services/monitor/lib/lib/models/smsReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/thresholdRuleCondition.js create mode 100644 lib/services/monitor/lib/lib/models/timeSeriesElement.js create mode 100644 lib/services/monitor/lib/lib/models/timeSeriesInformation.js create mode 100644 lib/services/monitor/lib/lib/models/timeWindow.js create mode 100644 lib/services/monitor/lib/lib/models/voiceReceiver.js create mode 100644 lib/services/monitor/lib/lib/models/webhookNotification.js create mode 100644 lib/services/monitor/lib/lib/models/webhookReceiver.js create mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.d.ts create mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.js create mode 100644 lib/services/monitor/lib/lib/operations/actionGroups.js create mode 100644 lib/services/monitor/lib/lib/operations/activityLogAlerts.js create mode 100644 lib/services/monitor/lib/lib/operations/activityLogs.js create mode 100644 lib/services/monitor/lib/lib/operations/alertRuleIncidents.js create mode 100644 lib/services/monitor/lib/lib/operations/alertRules.js create mode 100644 lib/services/monitor/lib/lib/operations/autoscaleSettings.js create mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js create mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js create mode 100644 lib/services/monitor/lib/lib/operations/eventCategories.js create mode 100644 lib/services/monitor/lib/lib/operations/index.d.ts create mode 100644 lib/services/monitor/lib/lib/operations/index.js create mode 100644 lib/services/monitor/lib/lib/operations/logProfiles.js create mode 100644 lib/services/monitor/lib/lib/operations/metricAlerts.js create mode 100644 lib/services/monitor/lib/lib/operations/metricAlertsStatus.js create mode 100644 lib/services/monitor/lib/lib/operations/metricBaseline.js create mode 100644 lib/services/monitor/lib/lib/operations/metricDefinitions.js create mode 100644 lib/services/monitor/lib/lib/operations/metrics.js create mode 100644 lib/services/monitor/lib/lib/operations/operations.js create mode 100644 lib/services/monitor/lib/lib/operations/tenantActivityLogs.js create mode 100644 lib/services/monitor/lib/package.json diff --git a/lib/services/monitor/lib/LICENSE.txt b/lib/services/monitor/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/monitor/lib/LICENSE.txt @@ -0,0 +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. diff --git a/lib/services/monitor/lib/lib/models/action.js b/lib/services/monitor/lib/lib/models/action.js new file mode 100644 index 0000000000..91eaf1b94d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/action.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 Action { + /** + * Create a Action. + * @member {string} [actionGroupId] the id of the action group to use. + * @member {object} [webhookProperties] + */ + constructor() { + } + + /** + * Defines the metadata of Action + * + * @returns {object} metadata of Action + * + */ + mapper() { + return { + required: false, + serializedName: 'Action', + type: { + name: 'Composite', + className: 'Action', + 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 = Action; diff --git a/lib/services/monitor/lib/lib/models/actionGroupList.js b/lib/services/monitor/lib/lib/models/actionGroupList.js new file mode 100644 index 0000000000..686e1c81f9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/actionGroupList.js @@ -0,0 +1,61 @@ +/* + * 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 list of action groups. + */ +class ActionGroupList extends Array { + /** + * Create a ActionGroupList. + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActionGroupList + * + * @returns {object} metadata of ActionGroupList + * + */ + mapper() { + return { + required: false, + serializedName: 'ActionGroupList', + type: { + name: 'Composite', + className: 'ActionGroupList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionGroupResourceElementType', + type: { + name: 'Composite', + className: 'ActionGroupResource' + } + } + } + } + } + } + }; + } +} + +module.exports = ActionGroupList; diff --git a/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js b/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js new file mode 100644 index 0000000000..c55155969f --- /dev/null +++ b/lib/services/monitor/lib/lib/models/actionGroupPatchBody.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'; + +/** + * An action group object for the body of patch operations. + * + */ +class ActionGroupPatchBody { + /** + * Create a ActionGroupPatchBody. + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its actions will + * be activated. Default value: true . + */ + constructor() { + } + + /** + * Defines the metadata of ActionGroupPatchBody + * + * @returns {object} metadata of ActionGroupPatchBody + * + */ + mapper() { + return { + required: false, + serializedName: 'ActionGroupPatchBody', + type: { + name: 'Composite', + className: 'ActionGroupPatchBody', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ActionGroupPatchBody; diff --git a/lib/services/monitor/lib/lib/models/actionGroupResource.js b/lib/services/monitor/lib/lib/models/actionGroupResource.js new file mode 100644 index 0000000000..9a443885a8 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/actionGroupResource.js @@ -0,0 +1,269 @@ +/* + * 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'); + +/** + * An action group resource. + * + * @extends models['Resource'] + */ +class ActionGroupResource extends models['Resource'] { + /** + * Create a ActionGroupResource. + * @member {string} groupShortName The short name of the action group. This + * will be used in SMS messages. + * @member {boolean} enabled Indicates whether this action group is enabled. + * If an action group is not enabled, then none of its receivers will receive + * communications. Default value: true . + * @member {array} [emailReceivers] The list of email receivers that are part + * of this action group. + * @member {array} [smsReceivers] The list of SMS receivers that are part of + * this action group. + * @member {array} [webhookReceivers] The list of webhook receivers that are + * part of this action group. + * @member {array} [itsmReceivers] The list of ITSM receivers that are part + * of this action group. + * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers + * 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(); + } + + /** + * Defines the metadata of ActionGroupResource + * + * @returns {object} metadata of ActionGroupResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ActionGroupResource', + type: { + name: 'Composite', + className: 'ActionGroupResource', + 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' + } + } + } + }, + groupShortName: { + required: true, + serializedName: 'properties.groupShortName', + constraints: { + MaxLength: 15 + }, + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + emailReceivers: { + required: false, + serializedName: 'properties.emailReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EmailReceiverElementType', + type: { + name: 'Composite', + className: 'EmailReceiver' + } + } + } + }, + smsReceivers: { + required: false, + serializedName: 'properties.smsReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SmsReceiverElementType', + type: { + name: 'Composite', + className: 'SmsReceiver' + } + } + } + }, + webhookReceivers: { + required: false, + serializedName: 'properties.webhookReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebhookReceiverElementType', + type: { + name: 'Composite', + className: 'WebhookReceiver' + } + } + } + }, + itsmReceivers: { + required: false, + serializedName: 'properties.itsmReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ItsmReceiverElementType', + type: { + name: 'Composite', + className: 'ItsmReceiver' + } + } + } + }, + azureAppPushReceivers: { + required: false, + serializedName: 'properties.azureAppPushReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AzureAppPushReceiverElementType', + type: { + name: 'Composite', + className: 'AzureAppPushReceiver' + } + } + } + }, + automationRunbookReceivers: { + required: false, + serializedName: 'properties.automationRunbookReceivers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutomationRunbookReceiverElementType', + type: { + name: 'Composite', + className: 'AutomationRunbookReceiver' + } + } + } + }, + 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' + } + } + } + } + } + } + }; + } +} + +module.exports = ActionGroupResource; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js new file mode 100644 index 0000000000..727c96320c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.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 pointer to an Azure Action Group. + * + */ +class ActivityLogAlertActionGroup { + /** + * Create a ActivityLogAlertActionGroup. + * @member {string} actionGroupId The resourceId of the action group. This + * cannot be null or empty. + * @member {object} [webhookProperties] the dictionary of custom properties + * to include with the post operation. These data are appended to the webhook + * payload. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertActionGroup + * + * @returns {object} metadata of ActivityLogAlertActionGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertActionGroup', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionGroup', + modelProperties: { + actionGroupId: { + required: true, + serializedName: 'actionGroupId', + type: { + name: 'String' + } + }, + webhookProperties: { + required: false, + serializedName: 'webhookProperties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertActionGroup; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js new file mode 100644 index 0000000000..2de7dd16fe --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js @@ -0,0 +1,62 @@ +/* + * 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'); + +/** + * A list of activity log alert actions. + * + */ +class ActivityLogAlertActionList { + /** + * Create a ActivityLogAlertActionList. + * @member {array} [actionGroups] The list of activity log alerts. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertActionList + * + * @returns {object} metadata of ActivityLogAlertActionList + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertActionList', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionList', + modelProperties: { + actionGroups: { + required: false, + serializedName: 'actionGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityLogAlertActionGroupElementType', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertActionList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js new file mode 100644 index 0000000000..234f03ce70 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.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'; + +const models = require('./index'); + +/** + * An Activity Log alert condition that is met when all its member conditions + * are met. + * + */ +class ActivityLogAlertAllOfCondition { + /** + * Create a ActivityLogAlertAllOfCondition. + * @member {array} allOf The list of activity log alert conditions. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertAllOfCondition + * + * @returns {object} metadata of ActivityLogAlertAllOfCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertAllOfCondition', + type: { + name: 'Composite', + className: 'ActivityLogAlertAllOfCondition', + modelProperties: { + allOf: { + required: true, + serializedName: 'allOf', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityLogAlertLeafConditionElementType', + type: { + name: 'Composite', + className: 'ActivityLogAlertLeafCondition' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertAllOfCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js new file mode 100644 index 0000000000..df05750642 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js @@ -0,0 +1,66 @@ +/* + * 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 Activity Log alert condition that is met by comparing an activity log + * field and value. + * + */ +class ActivityLogAlertLeafCondition { + /** + * Create a ActivityLogAlertLeafCondition. + * @member {string} field The name of the field that this condition will + * examine. The possible values for this field are (case-insensitive): + * 'resourceId', 'category', 'caller', 'level', 'operationName', + * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + * 'resourceType', or anything beginning with 'properties.'. + * @member {string} equals The field value will be compared to this value + * (case-insensitive) to determine if the condition is met. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertLeafCondition + * + * @returns {object} metadata of ActivityLogAlertLeafCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertLeafCondition', + type: { + name: 'Composite', + className: 'ActivityLogAlertLeafCondition', + modelProperties: { + field: { + required: true, + serializedName: 'field', + type: { + name: 'String' + } + }, + equals: { + required: true, + serializedName: 'equals', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertLeafCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertList.js b/lib/services/monitor/lib/lib/models/activityLogAlertList.js new file mode 100644 index 0000000000..6379f702f8 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertList.js @@ -0,0 +1,61 @@ +/* + * 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 list of activity log alerts. + */ +class ActivityLogAlertList extends Array { + /** + * Create a ActivityLogAlertList. + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActivityLogAlertList + * + * @returns {object} metadata of ActivityLogAlertList + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertList', + type: { + name: 'Composite', + className: 'ActivityLogAlertList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityLogAlertResourceElementType', + type: { + name: 'Composite', + className: 'ActivityLogAlertResource' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js b/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js new file mode 100644 index 0000000000..aa120768da --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.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'; + +/** + * An activity log alert object for the body of patch operations. + * + */ +class ActivityLogAlertPatchBody { + /** + * Create a ActivityLogAlertPatchBody. + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + */ + constructor() { + } + + /** + * Defines the metadata of ActivityLogAlertPatchBody + * + * @returns {object} metadata of ActivityLogAlertPatchBody + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertPatchBody', + type: { + name: 'Composite', + className: 'ActivityLogAlertPatchBody', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertPatchBody; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertResource.js b/lib/services/monitor/lib/lib/models/activityLogAlertResource.js new file mode 100644 index 0000000000..dc857e34d9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/activityLogAlertResource.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * An activity log alert resource. + * + * @extends models['Resource'] + */ +class ActivityLogAlertResource extends models['Resource'] { + /** + * Create a ActivityLogAlertResource. + * @member {array} scopes A list of resourceIds that will be used as + * prefixes. The alert will only apply to activityLogs with resourceIds that + * fall under one of these prefixes. This list must include at least one + * item. + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + * @member {object} condition The condition that will cause this alert to + * activate. + * @member {array} [condition.allOf] The list of activity log alert + * conditions. + * @member {object} actions The actions that will activate when the condition + * is met. + * @member {array} [actions.actionGroups] The list of activity log alerts. + * @member {string} [description] A description of this activity log alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActivityLogAlertResource + * + * @returns {object} metadata of ActivityLogAlertResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityLogAlertResource', + type: { + name: 'Composite', + className: 'ActivityLogAlertResource', + 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' + } + } + } + }, + scopes: { + required: true, + serializedName: 'properties.scopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + condition: { + required: true, + serializedName: 'properties.condition', + type: { + name: 'Composite', + className: 'ActivityLogAlertAllOfCondition' + } + }, + actions: { + required: true, + serializedName: 'properties.actions', + type: { + name: 'Composite', + className: 'ActivityLogAlertActionList' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ActivityLogAlertResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResource.js b/lib/services/monitor/lib/lib/models/alertRuleResource.js new file mode 100644 index 0000000000..40978cb847 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/alertRuleResource.js @@ -0,0 +1,175 @@ +/* + * 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 alert rule resource. + * + * @extends models['Resource'] + */ +class AlertRuleResource extends models['Resource'] { + /** + * Create a AlertRuleResource. + * @member {string} alertRuleResourceName the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property + * cannot be updated for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic + * Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AlertRuleResource + * + * @returns {object} metadata of AlertRuleResource + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertRuleResource', + type: { + name: 'Composite', + className: 'AlertRuleResource', + 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' + } + } + } + }, + alertRuleResourceName: { + required: true, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + condition: { + required: true, + serializedName: 'properties.condition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'RuleCondition' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RuleActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleAction' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = AlertRuleResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js b/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js new file mode 100644 index 0000000000..40dd02b71e --- /dev/null +++ b/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.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 alert rule resources. + */ +class AlertRuleResourceCollection extends Array { + /** + * Create a AlertRuleResourceCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AlertRuleResourceCollection + * + * @returns {object} metadata of AlertRuleResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertRuleResourceCollection', + type: { + name: 'Composite', + className: 'AlertRuleResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AlertRuleResourceElementType', + type: { + name: 'Composite', + className: 'AlertRuleResource' + } + } + } + } + } + } + }; + } +} + +module.exports = AlertRuleResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js b/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js new file mode 100644 index 0000000000..3094d95d8b --- /dev/null +++ b/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js @@ -0,0 +1,143 @@ +/* + * 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 alert rule object for patch operations. + * + */ +class AlertRuleResourcePatch { + /** + * Create a AlertRuleResourcePatch. + * @member {object} [tags] Resource tags + * @member {string} name the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property + * cannot be updated for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic + * Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + } + + /** + * Defines the metadata of AlertRuleResourcePatch + * + * @returns {object} metadata of AlertRuleResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'AlertRuleResourcePatch', + type: { + name: 'Composite', + className: 'AlertRuleResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + name: { + required: true, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + condition: { + required: true, + serializedName: 'properties.condition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'RuleCondition' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RuleActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleAction' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = AlertRuleResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js b/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js new file mode 100644 index 0000000000..b54ae4d250 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js @@ -0,0 +1,95 @@ +/* + * 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 Azure Automation Runbook notification receiver. + * + */ +class AutomationRunbookReceiver { + /** + * Create a AutomationRunbookReceiver. + * @member {string} automationAccountId The Azure automation account Id which + * holds this runbook and authenticate to Azure resource. + * @member {string} runbookName The name for this runbook. + * @member {string} webhookResourceId The resource id for webhook linked to + * this runbook. + * @member {boolean} isGlobalRunbook Indicates whether this instance is + * global runbook. + * @member {string} [name] Indicates name of the webhook. + * @member {string} [serviceUri] The URI where webhooks should be sent. + */ + constructor() { + } + + /** + * Defines the metadata of AutomationRunbookReceiver + * + * @returns {object} metadata of AutomationRunbookReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomationRunbookReceiver', + type: { + name: 'Composite', + className: 'AutomationRunbookReceiver', + modelProperties: { + automationAccountId: { + required: true, + serializedName: 'automationAccountId', + type: { + name: 'String' + } + }, + runbookName: { + required: true, + serializedName: 'runbookName', + type: { + name: 'String' + } + }, + webhookResourceId: { + required: true, + serializedName: 'webhookResourceId', + type: { + name: 'String' + } + }, + isGlobalRunbook: { + required: true, + serializedName: 'isGlobalRunbook', + type: { + name: 'Boolean' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + serviceUri: { + required: false, + serializedName: 'serviceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutomationRunbookReceiver; diff --git a/lib/services/monitor/lib/lib/models/autoscaleNotification.js b/lib/services/monitor/lib/lib/models/autoscaleNotification.js new file mode 100644 index 0000000000..d56fcbc701 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleNotification.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'; + +const models = require('./index'); + +/** + * Autoscale notification. + * + */ +class AutoscaleNotification { + /** + * Create a AutoscaleNotification. + * @member {object} [email] the email notification. + * @member {boolean} [email.sendToSubscriptionAdministrator] a value + * indicating whether to send email to subscription administrator. + * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value + * indicating whether to send email to subscription co-administrators. + * @member {array} [email.customEmails] the custom e-mails list. This value + * can be null or empty, in which case this attribute will be ignored. + * @member {array} [webhooks] the collection of webhook notifications. + */ + constructor() { + } + + /** + * Defines the metadata of AutoscaleNotification + * + * @returns {object} metadata of AutoscaleNotification + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleNotification', + type: { + name: 'Composite', + className: 'AutoscaleNotification', + modelProperties: { + operation: { + required: true, + isConstant: true, + serializedName: 'operation', + defaultValue: 'Scale', + type: { + name: 'String' + } + }, + email: { + required: false, + serializedName: 'email', + type: { + name: 'Composite', + className: 'EmailNotification' + } + }, + webhooks: { + required: false, + serializedName: 'webhooks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebhookNotificationElementType', + type: { + name: 'Composite', + className: 'WebhookNotification' + } + } + } + } + } + } + }; + } +} + +module.exports = AutoscaleNotification; diff --git a/lib/services/monitor/lib/lib/models/autoscaleProfile.js b/lib/services/monitor/lib/lib/models/autoscaleProfile.js new file mode 100644 index 0000000000..a26c7a898f --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleProfile.js @@ -0,0 +1,204 @@ +/* + * 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'); + +/** + * Autoscale profile. + * + */ +class AutoscaleProfile { + /** + * Create a AutoscaleProfile. + * @member {string} name the name of the profile. + * @member {object} capacity the number of instances that can be used during + * this profile. + * @member {string} [capacity.minimum] the minimum number of instances for + * the resource. + * @member {string} [capacity.maximum] the maximum number of instances for + * the resource. The actual maximum number of instances is limited by the + * cores that are available in the subscription. + * @member {string} [capacity.default] the number of instances that will be + * set if metrics are not available for evaluation. The default is only used + * if the current instance count is lower than the default. + * @member {array} rules the collection of rules that provide the triggers + * and parameters for the scaling action. A maximum of 10 rules can be + * specified. + * @member {object} [fixedDate] the specific date-time for the profile. This + * element is not used if the Recurrence element is used. + * @member {string} [fixedDate.timeZone] the timezone of the start and end + * times for the profile. Some examples of valid timezones are: Dateline + * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, + * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain + * Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, + * Central America Standard Time, Central Standard Time, Central Standard + * Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, + * Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, + * Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard + * Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland + * Standard Time, E. South America Standard Time, Argentina Standard Time, SA + * Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, + * Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard + * Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard + * Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe + * Standard Time, Romance Standard Time, Central European Standard Time, W. + * Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, + * GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria + * Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE + * Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad + * Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard + * Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard + * Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, + * Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, + * Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard + * Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard + * Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard + * Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar + * Standard Time, SE Asia Standard Time, North Asia Standard Time, China + * Standard Time, North Asia East Standard Time, Singapore Standard Time, W. + * Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia + * Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New + * Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard + * Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {date} [fixedDate.start] the start time for the profile in ISO + * 8601 format. + * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 + * 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 + * of the profile. Some examples of valid timezones are: Dateline Standard + * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific + * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, + * Mountain Standard Time (Mexico), Mountain Standard Time, Central America + * Standard Time, Central Standard Time, Central Standard Time (Mexico), + * Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard + * Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard + * Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western + * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + * South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [recurrence.schedule.days] the collection of days that the + * profile takes effect on. Possible values are Sunday through Saturday. + * @member {array} [recurrence.schedule.hours] A collection of hours that the + * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock + * (AM/PM times are not supported). + * @member {array} [recurrence.schedule.minutes] A collection of minutes at + * which the profile takes effect at. + */ + constructor() { + } + + /** + * Defines the metadata of AutoscaleProfile + * + * @returns {object} metadata of AutoscaleProfile + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleProfile', + type: { + name: 'Composite', + className: 'AutoscaleProfile', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + capacity: { + required: true, + serializedName: 'capacity', + type: { + name: 'Composite', + className: 'ScaleCapacity' + } + }, + rules: { + required: true, + serializedName: 'rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ScaleRuleElementType', + type: { + name: 'Composite', + className: 'ScaleRule' + } + } + } + }, + fixedDate: { + required: false, + serializedName: 'fixedDate', + type: { + name: 'Composite', + className: 'TimeWindow' + } + }, + recurrence: { + required: false, + serializedName: 'recurrence', + type: { + name: 'Composite', + className: 'Recurrence' + } + } + } + } + }; + } +} + +module.exports = AutoscaleProfile; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js new file mode 100644 index 0000000000..d5363c2f72 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js @@ -0,0 +1,159 @@ +/* + * 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 autoscale setting resource. + * + * @extends models['Resource'] + */ +class AutoscaleSettingResource extends models['Resource'] { + /** + * Create a AutoscaleSettingResource. + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [autoscaleSettingResourceName] the name of the autoscale + * setting. + * @member {string} [targetResourceUri] the resource identifier of the + * resource that the autoscale setting should be added to. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutoscaleSettingResource + * + * @returns {object} metadata of AutoscaleSettingResource + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleSettingResource', + type: { + name: 'Composite', + className: 'AutoscaleSettingResource', + 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' + } + } + } + }, + profiles: { + required: true, + serializedName: 'properties.profiles', + constraints: { + MaxItems: 20 + }, + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleProfileElementType', + type: { + name: 'Composite', + className: 'AutoscaleProfile' + } + } + } + }, + notifications: { + required: false, + serializedName: 'properties.notifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleNotificationElementType', + type: { + name: 'Composite', + className: 'AutoscaleNotification' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + autoscaleSettingResourceName: { + required: false, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + targetResourceUri: { + required: false, + serializedName: 'properties.targetResourceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutoscaleSettingResource; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js new file mode 100644 index 0000000000..0f0ca6ac53 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.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'; + +/** + * Represents a collection of autoscale setting resources. + */ +class AutoscaleSettingResourceCollection extends Array { + /** + * Create a AutoscaleSettingResourceCollection. + * @member {string} [nextLink] URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutoscaleSettingResourceCollection + * + * @returns {object} metadata of AutoscaleSettingResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleSettingResourceCollection', + type: { + name: 'Composite', + className: 'AutoscaleSettingResourceCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleSettingResourceElementType', + type: { + name: 'Composite', + className: 'AutoscaleSettingResource' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutoscaleSettingResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js new file mode 100644 index 0000000000..fe1ac2f14a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js @@ -0,0 +1,126 @@ +/* + * 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 autoscale setting object for patch operations. + * + */ +class AutoscaleSettingResourcePatch { + /** + * Create a AutoscaleSettingResourcePatch. + * @member {object} [tags] Resource tags + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [name] the name of the autoscale setting. + * @member {string} [targetResourceUri] the resource identifier of the + * resource that the autoscale setting should be added to. + */ + constructor() { + } + + /** + * Defines the metadata of AutoscaleSettingResourcePatch + * + * @returns {object} metadata of AutoscaleSettingResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoscaleSettingResourcePatch', + type: { + name: 'Composite', + className: 'AutoscaleSettingResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + profiles: { + required: true, + serializedName: 'properties.profiles', + constraints: { + MaxItems: 20 + }, + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleProfileElementType', + type: { + name: 'Composite', + className: 'AutoscaleProfile' + } + } + } + }, + notifications: { + required: false, + serializedName: 'properties.notifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutoscaleNotificationElementType', + type: { + name: 'Composite', + className: 'AutoscaleNotification' + } + } + } + }, + enabled: { + required: false, + serializedName: 'properties.enabled', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + name: { + required: false, + serializedName: 'properties.name', + type: { + name: 'String' + } + }, + targetResourceUri: { + required: false, + serializedName: 'properties.targetResourceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutoscaleSettingResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js b/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js new file mode 100644 index 0000000000..0360bb90f0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js @@ -0,0 +1,62 @@ +/* + * 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 Azure mobile App push notification receiver. + * + */ +class AzureAppPushReceiver { + /** + * Create a AzureAppPushReceiver. + * @member {string} name The name of the Azure mobile app push receiver. + * Names must be unique across all receivers within an action group. + * @member {string} emailAddress The email address registered for the Azure + * mobile app. + */ + constructor() { + } + + /** + * Defines the metadata of AzureAppPushReceiver + * + * @returns {object} metadata of AzureAppPushReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureAppPushReceiver', + type: { + name: 'Composite', + className: 'AzureAppPushReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + emailAddress: { + required: true, + serializedName: 'emailAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureAppPushReceiver; diff --git a/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js b/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js new file mode 100644 index 0000000000..1252eef8a7 --- /dev/null +++ b/lib/services/monitor/lib/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/monitor/lib/lib/models/baseline.js b/lib/services/monitor/lib/lib/models/baseline.js new file mode 100644 index 0000000000..ffd9d6f3eb --- /dev/null +++ b/lib/services/monitor/lib/lib/models/baseline.js @@ -0,0 +1,84 @@ +/* + * 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 baseline values for a single sensitivity value. + * + */ +class Baseline { + /** + * Create a Baseline. + * @member {string} sensitivity the sensitivity of the baseline. Possible + * values include: 'Low', 'Medium', 'High' + * @member {array} lowThresholds The low thresholds of the baseline. + * @member {array} highThresholds The high thresholds of the baseline. + */ + constructor() { + } + + /** + * Defines the metadata of Baseline + * + * @returns {object} metadata of Baseline + * + */ + mapper() { + return { + required: false, + serializedName: 'Baseline', + type: { + name: 'Composite', + className: 'Baseline', + modelProperties: { + sensitivity: { + required: true, + serializedName: 'sensitivity', + type: { + name: 'Enum', + allowedValues: [ 'Low', 'Medium', 'High' ] + } + }, + lowThresholds: { + required: true, + serializedName: 'lowThresholds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + highThresholds: { + required: true, + serializedName: 'highThresholds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = Baseline; diff --git a/lib/services/monitor/lib/lib/models/baselineMetadataValue.js b/lib/services/monitor/lib/lib/models/baselineMetadataValue.js new file mode 100644 index 0000000000..f0353fa4b3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/baselineMetadataValue.js @@ -0,0 +1,65 @@ +/* + * 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'); + +/** + * Represents a baseline metadata value. + * + */ +class BaselineMetadataValue { + /** + * Create a BaselineMetadataValue. + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ + constructor() { + } + + /** + * Defines the metadata of BaselineMetadataValue + * + * @returns {object} metadata of BaselineMetadataValue + * + */ + mapper() { + return { + required: false, + serializedName: 'BaselineMetadataValue', + type: { + name: 'Composite', + className: 'BaselineMetadataValue', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BaselineMetadataValue; diff --git a/lib/services/monitor/lib/lib/models/baselineResponse.js b/lib/services/monitor/lib/lib/models/baselineResponse.js new file mode 100644 index 0000000000..db9e23dd39 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/baselineResponse.js @@ -0,0 +1,154 @@ +/* + * 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 response to a baseline query. + * + */ +class BaselineResponse { + /** + * Create a BaselineResponse. + * @member {string} [id] the metric baseline Id. + * @member {string} [type] the resource type of the baseline resource. + * @member {object} [name] the name and the display name of the metric, i.e. + * it is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [timespan] The timespan for which the data was retrieved. + * Its value consists of two datatimes concatenated, separated by '/'. This + * may be adjusted in the future and returned back from what was originally + * requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if + * a metadata request was made. + * @member {string} [aggregation] The aggregation type of the metric. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} [baseline] the baseline values for each sensitivity. + * @member {array} [metadata] the baseline metadata values. + */ + constructor() { + } + + /** + * Defines the metadata of BaselineResponse + * + * @returns {object} metadata of BaselineResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'BaselineResponse', + type: { + name: 'Composite', + className: 'BaselineResponse', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + timespan: { + required: false, + serializedName: 'properties.timespan', + type: { + name: 'String' + } + }, + interval: { + required: false, + serializedName: 'properties.interval', + type: { + name: 'TimeSpan' + } + }, + aggregation: { + required: false, + serializedName: 'properties.aggregation', + type: { + name: 'String' + } + }, + timestamps: { + required: false, + serializedName: 'properties.timestamps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DateElementType', + type: { + name: 'DateTime' + } + } + } + }, + baseline: { + required: false, + serializedName: 'properties.baseline', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaselineElementType', + type: { + name: 'Composite', + className: 'Baseline' + } + } + } + }, + metadata: { + required: false, + serializedName: 'properties.metadata', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaselineMetadataValueElementType', + type: { + name: 'Composite', + className: 'BaselineMetadataValue' + } + } + } + } + } + } + }; + } +} + +module.exports = BaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js b/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js new file mode 100644 index 0000000000..3b8328e966 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js @@ -0,0 +1,85 @@ +/* + * 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 response to a calcualte baseline call. + * + */ +class CalculateBaselineResponse { + /** + * Create a CalculateBaselineResponse. + * @member {string} type the resource type of the baseline resource. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} baseline the baseline values for each sensitivity. + */ + constructor() { + } + + /** + * Defines the metadata of CalculateBaselineResponse + * + * @returns {object} metadata of CalculateBaselineResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'CalculateBaselineResponse', + type: { + name: 'Composite', + className: 'CalculateBaselineResponse', + modelProperties: { + type: { + required: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + timestamps: { + required: false, + serializedName: 'timestamps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DateElementType', + type: { + name: 'DateTime' + } + } + } + }, + baseline: { + required: true, + serializedName: 'baseline', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BaselineElementType', + type: { + name: 'Composite', + className: 'Baseline' + } + } + } + } + } + } + }; + } +} + +module.exports = CalculateBaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js new file mode 100644 index 0000000000..00e2c23663 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js @@ -0,0 +1,82 @@ +/* + * 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 diagnostic settings category resource. + * + * @extends models['ProxyOnlyResource'] + */ +class DiagnosticSettingsCategoryResource extends models['ProxyOnlyResource'] { + /** + * Create a DiagnosticSettingsCategoryResource. + * @member {string} [categoryType] The type of the diagnostic settings + * category. Possible values include: 'Metrics', 'Logs' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiagnosticSettingsCategoryResource + * + * @returns {object} metadata of DiagnosticSettingsCategoryResource + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsCategoryResource', + type: { + name: 'Composite', + className: 'DiagnosticSettingsCategoryResource', + 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' + } + }, + categoryType: { + required: false, + serializedName: 'properties.categoryType', + type: { + name: 'Enum', + allowedValues: [ 'Metrics', 'Logs' ] + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsCategoryResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js new file mode 100644 index 0000000000..00199aec14 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.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'; + +const models = require('./index'); + +/** + * Represents a collection of diagnostic setting category resources. + * + */ +class DiagnosticSettingsCategoryResourceCollection { + /** + * Create a DiagnosticSettingsCategoryResourceCollection. + * @member {array} [value] The collection of diagnostic settings category + * resources. + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticSettingsCategoryResourceCollection + * + * @returns {object} metadata of DiagnosticSettingsCategoryResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsCategoryResourceCollection', + type: { + name: 'Composite', + className: 'DiagnosticSettingsCategoryResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiagnosticSettingsCategoryResourceElementType', + type: { + name: 'Composite', + className: 'DiagnosticSettingsCategoryResource' + } + } + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsCategoryResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js new file mode 100644 index 0000000000..b255747c24 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js @@ -0,0 +1,142 @@ +/* + * 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 diagnostic setting resource. + * + * @extends models['ProxyOnlyResource'] + */ +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} [eventHubAuthorizationRuleId] The resource Id for the + * event hub authorization rule. + * @member {string} [eventHubName] The name of the event hub. If none is + * specified, the default event hub will be selected. + * @member {array} [metrics] the list of metric settings. + * @member {array} [logs] the list of logs settings. + * @member {string} [workspaceId] The workspace ID (resource ID of a Log + * Analytics workspace) for a Log Analytics workspace to which you would like + * to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DiagnosticSettingsResource + * + * @returns {object} metadata of DiagnosticSettingsResource + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsResource', + type: { + name: 'Composite', + className: 'DiagnosticSettingsResource', + 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' + } + }, + storageAccountId: { + required: false, + serializedName: 'properties.storageAccountId', + type: { + name: 'String' + } + }, + eventHubAuthorizationRuleId: { + required: false, + serializedName: 'properties.eventHubAuthorizationRuleId', + type: { + name: 'String' + } + }, + eventHubName: { + required: false, + serializedName: 'properties.eventHubName', + type: { + name: 'String' + } + }, + metrics: { + required: false, + serializedName: 'properties.metrics', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricSettingsElementType', + type: { + name: 'Composite', + className: 'MetricSettings' + } + } + } + }, + logs: { + required: false, + serializedName: 'properties.logs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogSettingsElementType', + type: { + name: 'Composite', + className: 'LogSettings' + } + } + } + }, + workspaceId: { + required: false, + serializedName: 'properties.workspaceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js new file mode 100644 index 0000000000..89650e1336 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js @@ -0,0 +1,62 @@ +/* + * 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'); + +/** + * Represents a collection of alert rule resources. + * + */ +class DiagnosticSettingsResourceCollection { + /** + * Create a DiagnosticSettingsResourceCollection. + * @member {array} [value] The collection of diagnostic settings resources;. + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticSettingsResourceCollection + * + * @returns {object} metadata of DiagnosticSettingsResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticSettingsResourceCollection', + type: { + name: 'Composite', + className: 'DiagnosticSettingsResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiagnosticSettingsResourceElementType', + type: { + name: 'Composite', + className: 'DiagnosticSettingsResource' + } + } + } + } + } + } + }; + } +} + +module.exports = DiagnosticSettingsResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/emailNotification.js b/lib/services/monitor/lib/lib/models/emailNotification.js new file mode 100644 index 0000000000..c11f1b2d24 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/emailNotification.js @@ -0,0 +1,78 @@ +/* + * 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'; + +/** + * Email notification of an autoscale event. + * + */ +class EmailNotification { + /** + * Create a EmailNotification. + * @member {boolean} [sendToSubscriptionAdministrator] a value indicating + * whether to send email to subscription administrator. + * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating + * whether to send email to subscription co-administrators. + * @member {array} [customEmails] the custom e-mails list. This value can be + * null or empty, in which case this attribute will be ignored. + */ + constructor() { + } + + /** + * Defines the metadata of EmailNotification + * + * @returns {object} metadata of EmailNotification + * + */ + mapper() { + return { + required: false, + serializedName: 'EmailNotification', + type: { + name: 'Composite', + className: 'EmailNotification', + modelProperties: { + sendToSubscriptionAdministrator: { + required: false, + serializedName: 'sendToSubscriptionAdministrator', + type: { + name: 'Boolean' + } + }, + sendToSubscriptionCoAdministrators: { + required: false, + serializedName: 'sendToSubscriptionCoAdministrators', + type: { + name: 'Boolean' + } + }, + customEmails: { + required: false, + serializedName: 'customEmails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = EmailNotification; diff --git a/lib/services/monitor/lib/lib/models/emailReceiver.js b/lib/services/monitor/lib/lib/models/emailReceiver.js new file mode 100644 index 0000000000..508eac1ad4 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/emailReceiver.js @@ -0,0 +1,72 @@ +/* + * 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 email receiver. + * + */ +class EmailReceiver { + /** + * Create a EmailReceiver. + * @member {string} name The name of the email receiver. Names must be unique + * across all receivers within an action group. + * @member {string} emailAddress The email address of this receiver. + * @member {string} [status] The receiver status of the e-mail. Possible + * values include: 'NotSpecified', 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of EmailReceiver + * + * @returns {object} metadata of EmailReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'EmailReceiver', + type: { + name: 'Composite', + className: 'EmailReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + emailAddress: { + required: true, + serializedName: 'emailAddress', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] + } + } + } + } + }; + } +} + +module.exports = EmailReceiver; diff --git a/lib/services/monitor/lib/lib/models/enableRequest.js b/lib/services/monitor/lib/lib/models/enableRequest.js new file mode 100644 index 0000000000..886d80bc33 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/enableRequest.js @@ -0,0 +1,52 @@ +/* + * 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'; + +/** + * Describes a receiver that should be resubscribed. + * + */ +class EnableRequest { + /** + * Create a EnableRequest. + * @member {string} receiverName The name of the receiver to resubscribe. + */ + constructor() { + } + + /** + * Defines the metadata of EnableRequest + * + * @returns {object} metadata of EnableRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'EnableRequest', + type: { + name: 'Composite', + className: 'EnableRequest', + modelProperties: { + receiverName: { + required: true, + serializedName: 'receiverName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnableRequest; diff --git a/lib/services/monitor/lib/lib/models/errorResponse.js b/lib/services/monitor/lib/lib/models/errorResponse.js new file mode 100644 index 0000000000..f952d62061 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/errorResponse.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Describes the format of Error response. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/monitor/lib/lib/models/eventCategoryCollection.js b/lib/services/monitor/lib/lib/models/eventCategoryCollection.js new file mode 100644 index 0000000000..5a8180acf9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/eventCategoryCollection.js @@ -0,0 +1,60 @@ +/* + * 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 collection of event categories. Currently possible values are: + * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + */ +class EventCategoryCollection extends Array { + /** + * Create a EventCategoryCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EventCategoryCollection + * + * @returns {object} metadata of EventCategoryCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'EventCategoryCollection', + type: { + name: 'Composite', + className: 'EventCategoryCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LocalizableStringElementType', + type: { + name: 'Composite', + className: 'LocalizableString' + } + } + } + } + } + } + }; + } +} + +module.exports = EventCategoryCollection; diff --git a/lib/services/monitor/lib/lib/models/eventData.js b/lib/services/monitor/lib/lib/models/eventData.js new file mode 100644 index 0000000000..4e8b1c3046 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/eventData.js @@ -0,0 +1,342 @@ +/* + * 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 Azure event log entries are of type EventData + * + */ +class EventData { + /** + * Create a EventData. + * @member {object} [authorization] + * @member {string} [authorization.action] the permissible actions. For + * instance: microsoft.support/supporttickets/write + * @member {string} [authorization.role] the role of the user. For instance: + * Subscription Admin + * @member {string} [authorization.scope] the scope. + * @member {object} [claims] key value pairs to identify ARM permissions. + * @member {string} [caller] the email address of the user who has performed + * the operation, the UPN claim or SPN claim based on availability. + * @member {string} [description] the description of the event. + * @member {string} [id] the Id of this event as required by ARM for RBAC. It + * contains the EventDataID and a timestamp information. + * @member {string} [eventDataId] the event data Id. This is a unique + * identifier for an event. + * @member {string} [correlationId] the correlation Id, usually a GUID in the + * string format. The correlation Id is shared among the events that belong + * to the same uber operation. + * @member {object} [eventName] the event name. This value should not be + * confused with OperationName. For practical purposes, OperationName might + * be more appealing to end users. + * @member {string} [eventName.value] the invariant value. + * @member {string} [eventName.localizedValue] the locale specific value. + * @member {object} [category] the event category. + * @member {string} [category.value] the invariant value. + * @member {string} [category.localizedValue] the locale specific value. + * @member {object} [httpRequest] the HTTP request info. Usually includes the + * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated + * the event) and 'method' (HTTP method e.g. PUT). + * @member {string} [httpRequest.clientRequestId] the client request id. + * @member {string} [httpRequest.clientIpAddress] the client Ip Address + * @member {string} [httpRequest.method] the Http request method. + * @member {string} [httpRequest.uri] the Uri. + * @member {string} [level] the event level. Possible values include: + * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + * @member {string} [resourceGroupName] the resource group name of the + * impacted resource. + * @member {object} [resourceProviderName] the resource provider name of the + * impacted resource. + * @member {string} [resourceProviderName.value] the invariant value. + * @member {string} [resourceProviderName.localizedValue] the locale specific + * value. + * @member {string} [resourceId] the resource uri that uniquely identifies + * the resource that caused this event. + * @member {object} [resourceType] the resource type + * @member {string} [resourceType.value] the invariant value. + * @member {string} [resourceType.localizedValue] the locale specific value. + * @member {string} [operationId] It is usually a GUID shared among the + * events corresponding to single operation. This value should not be + * confused with EventName. + * @member {object} [operationName] the operation name. + * @member {string} [operationName.value] the invariant value. + * @member {string} [operationName.localizedValue] the locale specific value. + * @member {object} [properties] the set of pairs (usually a + * Dictionary) that includes details about the event. + * @member {object} [status] a string describing the status of the operation. + * Some typical values are: Started, In progress, Succeeded, Failed, + * Resolved. + * @member {string} [status.value] the invariant value. + * @member {string} [status.localizedValue] the locale specific value. + * @member {object} [subStatus] the event sub status. Most of the time, when + * included, this captures the HTTP status code of the REST call. Common + * values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), + * Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad + * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), + * Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: + * 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP + * Status Code: 504) + * @member {string} [subStatus.value] the invariant value. + * @member {string} [subStatus.localizedValue] the locale specific value. + * @member {date} [eventTimestamp] the timestamp of when the event was + * generated by the Azure service processing the request corresponding the + * event. It in ISO 8601 format. + * @member {date} [submissionTimestamp] the timestamp of when the event + * became available for querying via this API. It is in ISO 8601 format. This + * value should not be confused eventTimestamp. As there might be a delay + * between the occurrence time of the event, and the time that the event is + * submitted to the Azure logging infrastructure. + * @member {string} [subscriptionId] the Azure subscription Id usually a + * GUID. + * @member {string} [tenantId] the Azure tenant Id + */ + constructor() { + } + + /** + * Defines the metadata of EventData + * + * @returns {object} metadata of EventData + * + */ + mapper() { + return { + required: false, + serializedName: 'EventData', + type: { + name: 'Composite', + className: 'EventData', + modelProperties: { + authorization: { + required: false, + readOnly: true, + serializedName: 'authorization', + type: { + name: 'Composite', + className: 'SenderAuthorization' + } + }, + claims: { + required: false, + readOnly: true, + serializedName: 'claims', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + caller: { + required: false, + readOnly: true, + serializedName: 'caller', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + eventDataId: { + required: false, + readOnly: true, + serializedName: 'eventDataId', + type: { + name: 'String' + } + }, + correlationId: { + required: false, + readOnly: true, + serializedName: 'correlationId', + type: { + name: 'String' + } + }, + eventName: { + required: false, + readOnly: true, + serializedName: 'eventName', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + category: { + required: false, + readOnly: true, + serializedName: 'category', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + httpRequest: { + required: false, + readOnly: true, + serializedName: 'httpRequest', + type: { + name: 'Composite', + className: 'HttpRequestInfo' + } + }, + level: { + required: false, + readOnly: true, + serializedName: 'level', + type: { + name: 'Enum', + allowedValues: [ 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' ] + } + }, + resourceGroupName: { + required: false, + readOnly: true, + serializedName: 'resourceGroupName', + type: { + name: 'String' + } + }, + resourceProviderName: { + required: false, + readOnly: true, + serializedName: 'resourceProviderName', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + resourceType: { + required: false, + readOnly: true, + serializedName: 'resourceType', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + operationId: { + required: false, + readOnly: true, + serializedName: 'operationId', + type: { + name: 'String' + } + }, + operationName: { + required: false, + readOnly: true, + serializedName: 'operationName', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + properties: { + required: false, + readOnly: true, + serializedName: 'properties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + subStatus: { + required: false, + readOnly: true, + serializedName: 'subStatus', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + eventTimestamp: { + required: false, + readOnly: true, + serializedName: 'eventTimestamp', + type: { + name: 'DateTime' + } + }, + submissionTimestamp: { + required: false, + readOnly: true, + serializedName: 'submissionTimestamp', + type: { + name: 'DateTime' + } + }, + subscriptionId: { + required: false, + readOnly: true, + serializedName: 'subscriptionId', + type: { + name: 'String' + } + }, + tenantId: { + required: false, + readOnly: true, + serializedName: 'tenantId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventData; diff --git a/lib/services/monitor/lib/lib/models/eventDataCollection.js b/lib/services/monitor/lib/lib/models/eventDataCollection.js new file mode 100644 index 0000000000..0fe4c985c9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/eventDataCollection.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Represents collection of events. + */ +class EventDataCollection extends Array { + /** + * Create a EventDataCollection. + * @member {string} [nextLink] Provides the link to retrieve the next set of + * events. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EventDataCollection + * + * @returns {object} metadata of EventDataCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'EventDataCollection', + type: { + name: 'Composite', + className: 'EventDataCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EventDataElementType', + type: { + name: 'Composite', + className: 'EventData' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EventDataCollection; diff --git a/lib/services/monitor/lib/lib/models/httpRequestInfo.js b/lib/services/monitor/lib/lib/models/httpRequestInfo.js new file mode 100644 index 0000000000..309dc12fd0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/httpRequestInfo.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The Http request info. + * + */ +class HttpRequestInfo { + /** + * Create a HttpRequestInfo. + * @member {string} [clientRequestId] the client request id. + * @member {string} [clientIpAddress] the client Ip Address + * @member {string} [method] the Http request method. + * @member {string} [uri] the Uri. + */ + constructor() { + } + + /** + * Defines the metadata of HttpRequestInfo + * + * @returns {object} metadata of HttpRequestInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'HttpRequestInfo', + type: { + name: 'Composite', + className: 'HttpRequestInfo', + modelProperties: { + clientRequestId: { + required: false, + serializedName: 'clientRequestId', + type: { + name: 'String' + } + }, + clientIpAddress: { + required: false, + serializedName: 'clientIpAddress', + type: { + name: 'String' + } + }, + method: { + required: false, + serializedName: 'method', + type: { + name: 'String' + } + }, + uri: { + required: false, + serializedName: 'uri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = HttpRequestInfo; diff --git a/lib/services/monitor/lib/lib/models/incident.js b/lib/services/monitor/lib/lib/models/incident.js new file mode 100644 index 0000000000..a591fb7efa --- /dev/null +++ b/lib/services/monitor/lib/lib/models/incident.js @@ -0,0 +1,93 @@ +/* + * 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 incident indicates the activation status of an alert rule. + * + */ +class Incident { + /** + * Create a Incident. + * @member {string} [name] Incident name. + * @member {string} [ruleName] Rule name that is associated with the + * incident. + * @member {boolean} [isActive] A boolean to indicate whether the incident is + * active or resolved. + * @member {date} [activatedTime] The time at which the incident was + * activated in ISO8601 format. + * @member {date} [resolvedTime] The time at which the incident was resolved + * in ISO8601 format. If null, it means the incident is still active. + */ + constructor() { + } + + /** + * Defines the metadata of Incident + * + * @returns {object} metadata of Incident + * + */ + mapper() { + return { + required: false, + serializedName: 'Incident', + type: { + name: 'Composite', + className: 'Incident', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + ruleName: { + required: false, + readOnly: true, + serializedName: 'ruleName', + type: { + name: 'String' + } + }, + isActive: { + required: false, + readOnly: true, + serializedName: 'isActive', + type: { + name: 'Boolean' + } + }, + activatedTime: { + required: false, + readOnly: true, + serializedName: 'activatedTime', + type: { + name: 'DateTime' + } + }, + resolvedTime: { + required: false, + readOnly: true, + serializedName: 'resolvedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = Incident; diff --git a/lib/services/monitor/lib/lib/models/incidentListResult.js b/lib/services/monitor/lib/lib/models/incidentListResult.js new file mode 100644 index 0000000000..968388fb50 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/incidentListResult.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'; + +/** + * The List incidents operation response. + */ +class IncidentListResult extends Array { + /** + * Create a IncidentListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IncidentListResult + * + * @returns {object} metadata of IncidentListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'IncidentListResult', + type: { + name: 'Composite', + className: 'IncidentListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IncidentElementType', + type: { + name: 'Composite', + className: 'Incident' + } + } + } + } + } + } + }; + } +} + +module.exports = IncidentListResult; diff --git a/lib/services/monitor/lib/lib/models/index.d.ts b/lib/services/monitor/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..44807752fe --- /dev/null +++ b/lib/services/monitor/lib/lib/models/index.d.ts @@ -0,0 +1,2298 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * An azure resource object + * + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + * @member {string} location Resource location + * @member {object} [tags] Resource tags + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ScaleCapacity class. + * @constructor + * The number of instances that can be used during this profile. + * + * @member {string} minimum the minimum number of instances for the resource. + * @member {string} maximum the maximum number of instances for the resource. + * The actual maximum number of instances is limited by the cores that are + * available in the subscription. + * @member {string} default the number of instances that will be set if metrics + * are not available for evaluation. The default is only used if the current + * instance count is lower than the default. + */ +export interface ScaleCapacity { + minimum: string; + maximum: string; + default: string; +} + +/** + * @class + * Initializes a new instance of the MetricTrigger class. + * @constructor + * The trigger that results in a scaling action. + * + * @member {string} metricName the name of the metric that defines what the + * rule monitors. + * @member {string} metricResourceUri the resource identifier of the resource + * the rule monitors. + * @member {moment.duration} timeGrain the granularity of metrics the rule + * monitors. Must be one of the predefined values returned from metric + * definitions for the metric. Must be between 12 hours and 1 minute. + * @member {string} statistic the metric statistic type. How the metrics from + * multiple instances are combined. Possible values include: 'Average', 'Min', + * 'Max', 'Sum' + * @member {moment.duration} timeWindow the range of time in which instance + * data is collected. This value must be greater than the delay in metric + * collection, which can vary from resource-to-resource. Must be between 12 + * hours and 5 minutes. + * @member {string} timeAggregation time aggregation type. How the data that is + * collected should be combined over time. The default value is Average. + * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' + * @member {string} operator the operator that is used to compare the metric + * data and the threshold. Possible values include: 'Equals', 'NotEquals', + * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold of the metric that triggers the + * scale action. + */ +export interface MetricTrigger { + metricName: string; + metricResourceUri: string; + timeGrain: moment.Duration; + statistic: string; + timeWindow: moment.Duration; + timeAggregation: string; + operator: string; + threshold: number; +} + +/** + * @class + * Initializes a new instance of the ScaleAction class. + * @constructor + * The parameters for the scaling action. + * + * @member {string} direction the scale direction. Whether the scaling action + * increases or decreases the number of instances. Possible values include: + * 'None', 'Increase', 'Decrease' + * @member {string} type the type of action that should occur when the scale + * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', + * 'ExactCount' + * @member {string} [value] the number of instances that are involved in the + * scaling action. This value must be 1 or greater. The default value is 1. + * Default value: '1' . + * @member {moment.duration} cooldown the amount of time to wait since the last + * scaling action before this action occurs. It must be between 1 week and 1 + * minute in ISO 8601 format. + */ +export interface ScaleAction { + direction: string; + type: string; + value?: string; + cooldown: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the ScaleRule class. + * @constructor + * A rule that provide the triggers and parameters for the scaling action. + * + * @member {object} metricTrigger the trigger that results in a scaling action. + * @member {string} [metricTrigger.metricName] the name of the metric that + * defines what the rule monitors. + * @member {string} [metricTrigger.metricResourceUri] the resource identifier + * of the resource the rule monitors. + * @member {moment.duration} [metricTrigger.timeGrain] the granularity of + * metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [metricTrigger.statistic] the metric statistic type. How + * the metrics from multiple instances are combined. Possible values include: + * 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [metricTrigger.timeWindow] the range of time in + * which instance data is collected. This value must be greater than the delay + * in metric collection, which can vary from resource-to-resource. Must be + * between 12 hours and 5 minutes. + * @member {string} [metricTrigger.timeAggregation] time aggregation type. How + * the data that is collected should be combined over time. The default value + * is Average. Possible values include: 'Average', 'Minimum', 'Maximum', + * 'Total', 'Count' + * @member {string} [metricTrigger.operator] the operator that is used to + * compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [metricTrigger.threshold] the threshold of the metric that + * triggers the scale action. + * @member {object} scaleAction the parameters for the scaling action. + * @member {string} [scaleAction.direction] the scale direction. Whether the + * scaling action increases or decreases the number of instances. Possible + * values include: 'None', 'Increase', 'Decrease' + * @member {string} [scaleAction.type] the type of action that should occur + * when the scale rule fires. Possible values include: 'ChangeCount', + * 'PercentChangeCount', 'ExactCount' + * @member {string} [scaleAction.value] the number of instances that are + * involved in the scaling action. This value must be 1 or greater. The default + * value is 1. + * @member {moment.duration} [scaleAction.cooldown] the amount of time to wait + * since the last scaling action before this action occurs. It must be between + * 1 week and 1 minute in ISO 8601 format. + */ +export interface ScaleRule { + metricTrigger: MetricTrigger; + scaleAction: ScaleAction; +} + +/** + * @class + * Initializes a new instance of the TimeWindow class. + * @constructor + * A specific date-time for the profile. + * + * @member {string} [timeZone] the timezone of the start and end times for the + * profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central + * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern + * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic + * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, + * Pacific SA Standard Time, Newfoundland Standard Time, E. South America + * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, + * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. + * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, + * Central European Standard Time, W. Central Africa Standard Time, Namibia + * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, + * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, + * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central + * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {date} start the start time for the profile in ISO 8601 format. + * @member {date} end the end time for the profile in ISO 8601 format. + */ +export interface TimeWindow { + timeZone?: string; + start: Date; + end: Date; +} + +/** + * @class + * Initializes a new instance of the RecurrentSchedule class. + * @constructor + * The scheduling constraints for when the profile begins. + * + * @member {string} timeZone the timezone for the hours of the profile. Some + * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian + * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), + * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time + * (Mexico), Mountain Standard Time, Central America Standard Time, Central + * Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, + * SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, + * Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, + * Central Brazilian Standard Time, SA Western Standard Time, Pacific SA + * Standard Time, Newfoundland Standard Time, E. South America Standard Time, + * Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, + * Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard + * Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, + * UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, + * Central Europe Standard Time, Romance Standard Time, Central European + * Standard Time, W. Central Africa Standard Time, Namibia Standard Time, + * Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt + * Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa + * Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard + * Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, + * Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa + * Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan + * Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian + * Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia + * Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India + * Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia + * Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} days the collection of days that the profile takes effect + * on. Possible values are Sunday through Saturday. + * @member {array} hours A collection of hours that the profile takes effect + * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not + * supported). + * @member {array} minutes A collection of minutes at which the profile takes + * effect at. + */ +export interface RecurrentSchedule { + timeZone: string; + days: string[]; + hours: number[]; + minutes: number[]; +} + +/** + * @class + * Initializes a new instance of the Recurrence class. + * @constructor + * 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 + * profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time + * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central + * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern + * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic + * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, + * Pacific SA Standard Time, Newfoundland Standard Time, E. South America + * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, + * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. + * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, + * Central European Standard Time, W. Central Africa Standard Time, Namibia + * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, + * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, + * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central + * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [schedule.days] the collection of days that the profile + * takes effect on. Possible values are Sunday through Saturday. + * @member {array} [schedule.hours] A collection of hours that the profile + * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM + * times are not supported). + * @member {array} [schedule.minutes] A collection of minutes at which the + * profile takes effect at. + */ +export interface Recurrence { + frequency: string; + schedule: RecurrentSchedule; +} + +/** + * @class + * Initializes a new instance of the AutoscaleProfile class. + * @constructor + * Autoscale profile. + * + * @member {string} name the name of the profile. + * @member {object} capacity the number of instances that can be used during + * this profile. + * @member {string} [capacity.minimum] the minimum number of instances for the + * resource. + * @member {string} [capacity.maximum] the maximum number of instances for the + * resource. The actual maximum number of instances is limited by the cores + * that are available in the subscription. + * @member {string} [capacity.default] the number of instances that will be set + * if metrics are not available for evaluation. The default is only used if the + * current instance count is lower than the default. + * @member {array} rules the collection of rules that provide the triggers and + * parameters for the scaling action. A maximum of 10 rules can be specified. + * @member {object} [fixedDate] the specific date-time for the profile. This + * element is not used if the Recurrence element is used. + * @member {string} [fixedDate.timeZone] the timezone of the start and end + * times for the profile. Some examples of valid timezones are: Dateline + * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, + * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard + * Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central + * America Standard Time, Central Standard Time, Central Standard Time + * (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern + * Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay + * Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA + * Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, + * E. South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya + * Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard + * Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, + * Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, + * Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, + * Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard + * Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, + * Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, + * N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, + * North Asia Standard Time, China Standard Time, North Asia East Standard + * Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard + * Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, + * Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard + * Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + * Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok + * Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia + * Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, + * Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line + * Islands Standard Time + * @member {date} [fixedDate.start] the start time for the profile in ISO 8601 + * format. + * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 + * 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 + * of the profile. Some examples of valid timezones are: Dateline Standard + * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific + * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, + * Mountain Standard Time (Mexico), Mountain Standard Time, Central America + * Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada + * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + * Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard + * Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America + * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, + * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. + * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, + * Central European Standard Time, W. Central Africa Standard Time, Namibia + * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard + * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, + * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel + * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic + * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard + * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, + * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, + * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central + * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard Time, + * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, + * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. + * Australia Standard Time, AUS Central Standard Time, E. Australia Standard + * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania + * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time + * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand + * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [recurrence.schedule.days] the collection of days that the + * profile takes effect on. Possible values are Sunday through Saturday. + * @member {array} [recurrence.schedule.hours] A collection of hours that the + * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock + * (AM/PM times are not supported). + * @member {array} [recurrence.schedule.minutes] A collection of minutes at + * which the profile takes effect at. + */ +export interface AutoscaleProfile { + name: string; + capacity: ScaleCapacity; + rules: ScaleRule[]; + fixedDate?: TimeWindow; + recurrence?: Recurrence; +} + +/** + * @class + * Initializes a new instance of the EmailNotification class. + * @constructor + * Email notification of an autoscale event. + * + * @member {boolean} [sendToSubscriptionAdministrator] a value indicating + * whether to send email to subscription administrator. + * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating + * whether to send email to subscription co-administrators. + * @member {array} [customEmails] the custom e-mails list. This value can be + * null or empty, in which case this attribute will be ignored. + */ +export interface EmailNotification { + sendToSubscriptionAdministrator?: boolean; + sendToSubscriptionCoAdministrators?: boolean; + customEmails?: string[]; +} + +/** + * @class + * Initializes a new instance of the WebhookNotification class. + * @constructor + * Webhook notification of an autoscale event. + * + * @member {string} [serviceUri] the service address to receive the + * notification. + * @member {object} [properties] a property bag of settings. This value can be + * empty. + */ +export interface WebhookNotification { + serviceUri?: string; + properties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the AutoscaleNotification class. + * @constructor + * Autoscale notification. + * + * @member {object} [email] the email notification. + * @member {boolean} [email.sendToSubscriptionAdministrator] a value indicating + * whether to send email to subscription administrator. + * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value + * indicating whether to send email to subscription co-administrators. + * @member {array} [email.customEmails] the custom e-mails list. This value can + * be null or empty, in which case this attribute will be ignored. + * @member {array} [webhooks] the collection of webhook notifications. + */ +export interface AutoscaleNotification { + email?: EmailNotification; + webhooks?: WebhookNotification[]; +} + +/** + * @class + * Initializes a new instance of the AutoscaleSettingResource class. + * @constructor + * The autoscale setting resource. + * + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [autoscaleSettingResourceName] the name of the autoscale + * setting. + * @member {string} [targetResourceUri] the resource identifier of the resource + * that the autoscale setting should be added to. + */ +export interface AutoscaleSettingResource extends Resource { + profiles: AutoscaleProfile[]; + notifications?: AutoscaleNotification[]; + enabled?: boolean; + autoscaleSettingResourceName?: string; + targetResourceUri?: string; +} + +/** + * @class + * Initializes a new instance of the AutoscaleSettingResourcePatch class. + * @constructor + * The autoscale setting object for patch operations. + * + * @member {object} [tags] Resource tags + * @member {array} profiles the collection of automatic scaling profiles that + * specify different scaling parameters for different time periods. A maximum + * of 20 profiles can be specified. + * @member {array} [notifications] the collection of notifications. + * @member {boolean} [enabled] the enabled flag. Specifies whether automatic + * scaling is enabled for the resource. The default value is 'true'. Default + * value: true . + * @member {string} [name] the name of the autoscale setting. + * @member {string} [targetResourceUri] the resource identifier of the resource + * that the autoscale setting should be added to. + */ +export interface AutoscaleSettingResourcePatch { + tags?: { [propertyName: string]: string }; + profiles: AutoscaleProfile[]; + notifications?: AutoscaleNotification[]; + enabled?: boolean; + name?: string; + targetResourceUri?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * Describes the format of Error response. + * + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Display metadata associated with the operation. + * + * @member {string} [provider] Service provider: Microsoft.Insights + * @member {string} [resource] Resource on which the operation is performed: + * AlertRules, Autoscale, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Microsoft Insights API operation definition. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft.Insights + * @member {string} [display.resource] Resource on which the operation is + * performed: AlertRules, Autoscale, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ +export interface Operation { + name?: string; + display?: OperationDisplay; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * Result of the request to list Microsoft.Insights operations. It contains a + * list of operations and a URL link to get the next set of results. + * + * @member {array} [value] List of operations supported by the + * Microsoft.Insights provider. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface OperationListResult { + value?: Operation[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the Incident class. + * @constructor + * An alert incident indicates the activation status of an alert rule. + * + * @member {string} [name] Incident name. + * @member {string} [ruleName] Rule name that is associated with the incident. + * @member {boolean} [isActive] A boolean to indicate whether the incident is + * active or resolved. + * @member {date} [activatedTime] The time at which the incident was activated + * in ISO8601 format. + * @member {date} [resolvedTime] The time at which the incident was resolved in + * ISO8601 format. If null, it means the incident is still active. + */ +export interface Incident { + readonly name?: string; + readonly ruleName?: string; + readonly isActive?: boolean; + readonly activatedTime?: Date; + readonly resolvedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the RuleDataSource class. + * @constructor + * The resource from which the rule collects its data. + * + * @member {string} [resourceUri] the resource identifier of the resource the + * rule monitors. **NOTE**: this property cannot be updated for an existing + * rule. + * @member {string} odatatype Polymorphic Discriminator + */ +export interface RuleDataSource { + resourceUri?: string; + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the RuleCondition class. + * @constructor + * The condition that results in the alert rule being activated. + * + * @member {object} [dataSource] the resource from which the rule collects its + * data. For this type dataSource will always be of type RuleMetricDataSource. + * @member {string} [dataSource.resourceUri] the resource identifier of the + * resource the rule monitors. **NOTE**: this property cannot be updated for an + * existing rule. + * @member {string} [dataSource.odatatype] Polymorphic Discriminator + * @member {string} odatatype Polymorphic Discriminator + */ +export interface RuleCondition { + dataSource?: RuleDataSource; + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the RuleMetricDataSource class. + * @constructor + * A rule metric data source. The discriminator value is always + * RuleMetricDataSource in this case. + * + * @member {string} [metricName] the name of the metric that defines what the + * rule monitors. + */ +export interface RuleMetricDataSource extends RuleDataSource { + metricName?: string; +} + +/** + * @class + * Initializes a new instance of the RuleManagementEventClaimsDataSource class. + * @constructor + * The claims for a rule management event data source. + * + * @member {string} [emailAddress] the email address. + */ +export interface RuleManagementEventClaimsDataSource { + emailAddress?: string; +} + +/** + * @class + * Initializes a new instance of the RuleManagementEventDataSource class. + * @constructor + * A rule management event data source. The discriminator fields is always + * RuleManagementEventDataSource in this case. + * + * @member {string} [eventName] the event name. + * @member {string} [eventSource] the event source. + * @member {string} [level] the level. + * @member {string} [operationName] The name of the operation that should be + * checked for. If no name is provided, any operation will match. + * @member {string} [resourceGroupName] the resource group name. + * @member {string} [resourceProviderName] the resource provider name. + * @member {string} [status] The status of the operation that should be checked + * for. If no status is provided, any status will match. + * @member {string} [subStatus] the substatus. + * @member {object} [claims] the claims. + * @member {string} [claims.emailAddress] the email address. + */ +export interface RuleManagementEventDataSource extends RuleDataSource { + eventName?: string; + eventSource?: string; + level?: string; + operationName?: string; + resourceGroupName?: string; + resourceProviderName?: string; + status?: string; + subStatus?: string; + claims?: RuleManagementEventClaimsDataSource; +} + +/** + * @class + * Initializes a new instance of the ThresholdRuleCondition class. + * @constructor + * A rule condition based on a metric crossing a threshold. + * + * @member {string} operator the operator used to compare the data and the + * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', + * 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {string} [timeAggregation] the time aggregation operator. How the + * data that are collected should be combined over time. The default value is + * the PrimaryAggregationType of the Metric. Possible values include: + * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' + */ +export interface ThresholdRuleCondition extends RuleCondition { + operator: string; + threshold: number; + windowSize?: moment.Duration; + timeAggregation?: string; +} + +/** + * @class + * Initializes a new instance of the LocationThresholdRuleCondition class. + * @constructor + * A rule condition based on a certain number of locations failing. + * + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {number} failedLocationCount the number of locations that must fail + * to activate the alert. + */ +export interface LocationThresholdRuleCondition extends RuleCondition { + windowSize?: moment.Duration; + failedLocationCount: number; +} + +/** + * @class + * Initializes a new instance of the ManagementEventAggregationCondition class. + * @constructor + * How the data that is collected should be combined over time. + * + * @member {string} [operator] the condition operator. Possible values include: + * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + * @member {number} [threshold] The threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + */ +export interface ManagementEventAggregationCondition { + operator?: string; + threshold?: number; + windowSize?: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the ManagementEventRuleCondition class. + * @constructor + * A management event rule condition. + * + * @member {object} [aggregation] How the data that is collected should be + * combined over time and when the alert is activated. Note that for management + * event alerts aggregation is optional – if it is not provided then any event + * will cause the alert to activate. + * @member {string} [aggregation.operator] the condition operator. Possible + * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [aggregation.threshold] The threshold value that activates + * the alert. + * @member {moment.duration} [aggregation.windowSize] the period of time (in + * ISO 8601 duration format) that is used to monitor alert activity based on + * the threshold. If specified then it must be between 5 minutes and 1 day. + */ +export interface ManagementEventRuleCondition extends RuleCondition { + aggregation?: ManagementEventAggregationCondition; +} + +/** + * @class + * Initializes a new instance of the RuleAction class. + * @constructor + * The action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @member {string} odatatype Polymorphic Discriminator + */ +export interface RuleAction { + odatatype: string; +} + +/** + * @class + * Initializes a new instance of the RuleEmailAction class. + * @constructor + * Specifies the action to send email when the rule condition is evaluated. The + * discriminator is always RuleEmailAction in this case. + * + * @member {boolean} [sendToServiceOwners] Whether the administrators (service + * and co-administrators) of the service should be notified when the alert is + * activated. + * @member {array} [customEmails] the list of administrator's custom email + * addresses to notify of the activation of the alert. + */ +export interface RuleEmailAction extends RuleAction { + sendToServiceOwners?: boolean; + customEmails?: string[]; +} + +/** + * @class + * Initializes a new instance of the RuleWebhookAction class. + * @constructor + * Specifies the action to post to service when the rule condition is + * evaluated. The discriminator is always RuleWebhookAction in this case. + * + * @member {string} [serviceUri] the service uri to Post the notification when + * the alert activates or resolves. + * @member {object} [properties] the dictionary of custom properties to include + * with the post operation. These data are appended to the webhook payload. + */ +export interface RuleWebhookAction extends RuleAction { + serviceUri?: string; + properties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the AlertRuleResource class. + * @constructor + * The alert rule resource. + * + * @member {string} alertRuleResourceName the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource identifier + * of the resource the rule monitors. **NOTE**: this property cannot be updated + * for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface AlertRuleResource extends Resource { + alertRuleResourceName: string; + description?: string; + isEnabled: boolean; + condition: RuleCondition; + actions?: RuleAction[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the AlertRuleResourcePatch class. + * @constructor + * The alert rule object for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} name the name of the alert rule. + * @member {string} [description] the description of the alert rule that will + * be included in the alert email. + * @member {boolean} isEnabled the flag that indicates whether the alert rule + * is enabled. + * @member {object} condition the condition that results in the alert rule + * being activated. + * @member {object} [condition.dataSource] the resource from which the rule + * collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [condition.dataSource.resourceUri] the resource identifier + * of the resource the rule monitors. **NOTE**: this property cannot be updated + * for an existing rule. + * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator + * @member {string} [condition.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface AlertRuleResourcePatch { + tags?: { [propertyName: string]: string }; + name: string; + description?: string; + isEnabled: boolean; + condition: RuleCondition; + actions?: RuleAction[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the RetentionPolicy class. + * @constructor + * Specifies the retention policy for the log. + * + * @member {boolean} enabled a value indicating whether the retention policy is + * enabled. + * @member {number} days the number of days for the retention in days. A value + * of 0 will retain the events indefinitely. + */ +export interface RetentionPolicy { + enabled: boolean; + days: number; +} + +/** + * @class + * Initializes a new instance of the LogProfileResource class. + * @constructor + * The log profile resource. + * + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories are + * created as is convenient to the user. Some values are: 'Write', 'Delete', + * and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in the + * log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface LogProfileResource extends Resource { + storageAccountId?: string; + serviceBusRuleId?: string; + locations: string[]; + categories: string[]; + retentionPolicy: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the LogProfileResourcePatch class. + * @constructor + * The log profile resource for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories are + * created as is convenient to the user. Some values are: 'Write', 'Delete', + * and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in the + * log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface LogProfileResourcePatch { + tags?: { [propertyName: string]: string }; + storageAccountId?: string; + serviceBusRuleId?: string; + locations: string[]; + categories: string[]; + retentionPolicy: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the ProxyOnlyResource class. + * @constructor + * A proxy only azure resource object + * + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + */ +export interface ProxyOnlyResource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the MetricSettings class. + * @constructor + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular metric. + * + * @member {moment.duration} [timeGrain] the timegrain of the metric in ISO8601 + * format. + * @member {string} [category] Name of a Diagnostic Metric category for a + * resource type this setting is applied to. To obtain the list of Diagnostic + * metric categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this category is + * enabled. + * @member {object} [retentionPolicy] the retention policy for this category. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface MetricSettings { + timeGrain?: moment.Duration; + category?: string; + enabled: boolean; + retentionPolicy?: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the LogSettings class. + * @constructor + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular log. + * + * @member {string} [category] Name of a Diagnostic Log category for a resource + * type this setting is applied to. To obtain the list of Diagnostic Log + * categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this log is enabled. + * @member {object} [retentionPolicy] the retention policy for this log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the retention + * in days. A value of 0 will retain the events indefinitely. + */ +export interface LogSettings { + category?: string; + enabled: boolean; + retentionPolicy?: RetentionPolicy; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsResource class. + * @constructor + * The diagnostic setting resource. + * + * @member {string} [storageAccountId] The resource ID of the storage account + * to which you would like to send Diagnostic Logs. + * @member {string} [eventHubAuthorizationRuleId] The resource Id for the event + * hub authorization rule. + * @member {string} [eventHubName] The name of the event hub. If none is + * specified, the default event hub will be selected. + * @member {array} [metrics] the list of metric settings. + * @member {array} [logs] the list of logs settings. + * @member {string} [workspaceId] The workspace ID (resource ID of a Log + * Analytics workspace) for a Log Analytics workspace to which you would like + * to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + */ +export interface DiagnosticSettingsResource extends ProxyOnlyResource { + storageAccountId?: string; + eventHubAuthorizationRuleId?: string; + eventHubName?: string; + metrics?: MetricSettings[]; + logs?: LogSettings[]; + workspaceId?: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsResourceCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + * @member {array} [value] The collection of diagnostic settings resources;. + */ +export interface DiagnosticSettingsResourceCollection { + value?: DiagnosticSettingsResource[]; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsCategoryResource class. + * @constructor + * The diagnostic settings category resource. + * + * @member {string} [categoryType] The type of the diagnostic settings + * category. Possible values include: 'Metrics', 'Logs' + */ +export interface DiagnosticSettingsCategoryResource extends ProxyOnlyResource { + categoryType?: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticSettingsCategoryResourceCollection class. + * @constructor + * Represents a collection of diagnostic setting category resources. + * + * @member {array} [value] The collection of diagnostic settings category + * resources. + */ +export interface DiagnosticSettingsCategoryResourceCollection { + value?: DiagnosticSettingsCategoryResource[]; +} + +/** + * @class + * Initializes a new instance of the EmailReceiver class. + * @constructor + * An email receiver. + * + * @member {string} name The name of the email receiver. Names must be unique + * across all receivers within an action group. + * @member {string} emailAddress The email address of this receiver. + * @member {string} [status] The receiver status of the e-mail. Possible values + * include: 'NotSpecified', 'Enabled', 'Disabled' + */ +export interface EmailReceiver { + name: string; + emailAddress: string; + readonly status?: string; +} + +/** + * @class + * Initializes a new instance of the SmsReceiver class. + * @constructor + * An SMS receiver. + * + * @member {string} name The name of the SMS receiver. Names must be unique + * across all receivers within an action group. + * @member {string} countryCode The country code of the SMS receiver. + * @member {string} phoneNumber The phone number of the SMS receiver. + * @member {string} [status] The status of the receiver. Possible values + * include: 'NotSpecified', 'Enabled', 'Disabled' + */ +export interface SmsReceiver { + name: string; + countryCode: string; + phoneNumber: string; + readonly status?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookReceiver class. + * @constructor + * A webhook receiver. + * + * @member {string} name The name of the webhook receiver. Names must be unique + * across all receivers within an action group. + * @member {string} serviceUri The URI where webhooks should be sent. + */ +export interface WebhookReceiver { + name: string; + serviceUri: string; +} + +/** + * @class + * Initializes a new instance of the ItsmReceiver class. + * @constructor + * An Itsm receiver. + * + * @member {string} name The name of the Itsm receiver. Names must be unique + * across all receivers within an action group. + * @member {string} workspaceId OMS LA instance identifier. + * @member {string} connectionId Unique identification of ITSM connection among + * multiple defined in above workspace. + * @member {string} ticketConfiguration JSON blob for the configurations of the + * ITSM action. CreateMultipleWorkItems option will be part of this blob as + * well. + * @member {string} region Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + */ +export interface ItsmReceiver { + name: string; + workspaceId: string; + connectionId: string; + ticketConfiguration: string; + region: string; +} + +/** + * @class + * Initializes a new instance of the AzureAppPushReceiver class. + * @constructor + * The Azure mobile App push notification receiver. + * + * @member {string} name The name of the Azure mobile app push receiver. Names + * must be unique across all receivers within an action group. + * @member {string} emailAddress The email address registered for the Azure + * mobile app. + */ +export interface AzureAppPushReceiver { + name: string; + emailAddress: string; +} + +/** + * @class + * Initializes a new instance of the AutomationRunbookReceiver class. + * @constructor + * The Azure Automation Runbook notification receiver. + * + * @member {string} automationAccountId The Azure automation account Id which + * holds this runbook and authenticate to Azure resource. + * @member {string} runbookName The name for this runbook. + * @member {string} webhookResourceId The resource id for webhook linked to + * this runbook. + * @member {boolean} isGlobalRunbook Indicates whether this instance is global + * runbook. + * @member {string} [name] Indicates name of the webhook. + * @member {string} [serviceUri] The URI where webhooks should be sent. + */ +export interface AutomationRunbookReceiver { + automationAccountId: string; + runbookName: string; + webhookResourceId: string; + isGlobalRunbook: boolean; + name?: string; + 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. + * @constructor + * An action group resource. + * + * @member {string} groupShortName The short name of the action group. This + * will be used in SMS messages. + * @member {boolean} enabled Indicates whether this action group is enabled. If + * an action group is not enabled, then none of its receivers will receive + * communications. Default value: true . + * @member {array} [emailReceivers] The list of email receivers that are part + * of this action group. + * @member {array} [smsReceivers] The list of SMS receivers that are part of + * this action group. + * @member {array} [webhookReceivers] The list of webhook receivers that are + * part of this action group. + * @member {array} [itsmReceivers] The list of ITSM receivers that are part of + * this action group. + * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers + * 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; + enabled: boolean; + emailReceivers?: EmailReceiver[]; + smsReceivers?: SmsReceiver[]; + webhookReceivers?: WebhookReceiver[]; + itsmReceivers?: ItsmReceiver[]; + azureAppPushReceivers?: AzureAppPushReceiver[]; + automationRunbookReceivers?: AutomationRunbookReceiver[]; + voiceReceivers?: VoiceReceiver[]; + logicAppReceivers?: LogicAppReceiver[]; + azureFunctionReceivers?: AzureFunctionReceiver[]; +} + +/** + * @class + * Initializes a new instance of the EnableRequest class. + * @constructor + * Describes a receiver that should be resubscribed. + * + * @member {string} receiverName The name of the receiver to resubscribe. + */ +export interface EnableRequest { + receiverName: string; +} + +/** + * @class + * Initializes a new instance of the ActionGroupPatchBody class. + * @constructor + * An action group object for the body of patch operations. + * + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this action group is enabled. + * If an action group is not enabled, then none of its actions will be + * activated. Default value: true . + */ +export interface ActionGroupPatchBody { + tags?: { [propertyName: string]: string }; + enabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertLeafCondition class. + * @constructor + * An Activity Log alert condition that is met by comparing an activity log + * field and value. + * + * @member {string} field The name of the field that this condition will + * examine. The possible values for this field are (case-insensitive): + * 'resourceId', 'category', 'caller', 'level', 'operationName', + * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', + * or anything beginning with 'properties.'. + * @member {string} equals The field value will be compared to this value + * (case-insensitive) to determine if the condition is met. + */ +export interface ActivityLogAlertLeafCondition { + field: string; + equals: string; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertAllOfCondition class. + * @constructor + * An Activity Log alert condition that is met when all its member conditions + * are met. + * + * @member {array} allOf The list of activity log alert conditions. + */ +export interface ActivityLogAlertAllOfCondition { + allOf: ActivityLogAlertLeafCondition[]; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertActionGroup class. + * @constructor + * A pointer to an Azure Action Group. + * + * @member {string} actionGroupId The resourceId of the action group. This + * cannot be null or empty. + * @member {object} [webhookProperties] the dictionary of custom properties to + * include with the post operation. These data are appended to the webhook + * payload. + */ +export interface ActivityLogAlertActionGroup { + actionGroupId: string; + webhookProperties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertActionList class. + * @constructor + * A list of activity log alert actions. + * + * @member {array} [actionGroups] The list of activity log alerts. + */ +export interface ActivityLogAlertActionList { + actionGroups?: ActivityLogAlertActionGroup[]; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertResource class. + * @constructor + * An activity log alert resource. + * + * @member {array} scopes A list of resourceIds that will be used as prefixes. + * The alert will only apply to activityLogs with resourceIds that fall under + * one of these prefixes. This list must include at least one item. + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + * @member {object} condition The condition that will cause this alert to + * activate. + * @member {array} [condition.allOf] The list of activity log alert conditions. + * @member {object} actions The actions that will activate when the condition + * is met. + * @member {array} [actions.actionGroups] The list of activity log alerts. + * @member {string} [description] A description of this activity log alert. + */ +export interface ActivityLogAlertResource extends Resource { + scopes: string[]; + enabled?: boolean; + condition: ActivityLogAlertAllOfCondition; + actions: ActivityLogAlertActionList; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertPatchBody class. + * @constructor + * An activity log alert object for the body of patch operations. + * + * @member {object} [tags] Resource tags + * @member {boolean} [enabled] Indicates whether this activity log alert is + * enabled. If an activity log alert is not enabled, then none of its actions + * will be activated. Default value: true . + */ +export interface ActivityLogAlertPatchBody { + tags?: { [propertyName: string]: string }; + enabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the LocalizableString class. + * @constructor + * The localizable string class. + * + * @member {string} value the invariant value. + * @member {string} [localizedValue] the locale specific value. + */ +export interface LocalizableString { + value: string; + localizedValue?: string; +} + +/** + * @class + * Initializes a new instance of the SenderAuthorization class. + * @constructor + * the authorization used by the user who has performed the operation that led + * to this event. This captures the RBAC properties of the event. These usually + * include the 'action', 'role' and the 'scope' + * + * @member {string} [action] the permissible actions. For instance: + * microsoft.support/supporttickets/write + * @member {string} [role] the role of the user. For instance: Subscription + * Admin + * @member {string} [scope] the scope. + */ +export interface SenderAuthorization { + action?: string; + role?: string; + scope?: string; +} + +/** + * @class + * Initializes a new instance of the HttpRequestInfo class. + * @constructor + * The Http request info. + * + * @member {string} [clientRequestId] the client request id. + * @member {string} [clientIpAddress] the client Ip Address + * @member {string} [method] the Http request method. + * @member {string} [uri] the Uri. + */ +export interface HttpRequestInfo { + clientRequestId?: string; + clientIpAddress?: string; + method?: string; + uri?: string; +} + +/** + * @class + * Initializes a new instance of the EventData class. + * @constructor + * The Azure event log entries are of type EventData + * + * @member {object} [authorization] + * @member {string} [authorization.action] the permissible actions. For + * instance: microsoft.support/supporttickets/write + * @member {string} [authorization.role] the role of the user. For instance: + * Subscription Admin + * @member {string} [authorization.scope] the scope. + * @member {object} [claims] key value pairs to identify ARM permissions. + * @member {string} [caller] the email address of the user who has performed + * the operation, the UPN claim or SPN claim based on availability. + * @member {string} [description] the description of the event. + * @member {string} [id] the Id of this event as required by ARM for RBAC. It + * contains the EventDataID and a timestamp information. + * @member {string} [eventDataId] the event data Id. This is a unique + * identifier for an event. + * @member {string} [correlationId] the correlation Id, usually a GUID in the + * string format. The correlation Id is shared among the events that belong to + * the same uber operation. + * @member {object} [eventName] the event name. This value should not be + * confused with OperationName. For practical purposes, OperationName might be + * more appealing to end users. + * @member {string} [eventName.value] the invariant value. + * @member {string} [eventName.localizedValue] the locale specific value. + * @member {object} [category] the event category. + * @member {string} [category.value] the invariant value. + * @member {string} [category.localizedValue] the locale specific value. + * @member {object} [httpRequest] the HTTP request info. Usually includes the + * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated + * the event) and 'method' (HTTP method e.g. PUT). + * @member {string} [httpRequest.clientRequestId] the client request id. + * @member {string} [httpRequest.clientIpAddress] the client Ip Address + * @member {string} [httpRequest.method] the Http request method. + * @member {string} [httpRequest.uri] the Uri. + * @member {string} [level] the event level. Possible values include: + * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' + * @member {string} [resourceGroupName] the resource group name of the impacted + * resource. + * @member {object} [resourceProviderName] the resource provider name of the + * impacted resource. + * @member {string} [resourceProviderName.value] the invariant value. + * @member {string} [resourceProviderName.localizedValue] the locale specific + * value. + * @member {string} [resourceId] the resource uri that uniquely identifies the + * resource that caused this event. + * @member {object} [resourceType] the resource type + * @member {string} [resourceType.value] the invariant value. + * @member {string} [resourceType.localizedValue] the locale specific value. + * @member {string} [operationId] It is usually a GUID shared among the events + * corresponding to single operation. This value should not be confused with + * EventName. + * @member {object} [operationName] the operation name. + * @member {string} [operationName.value] the invariant value. + * @member {string} [operationName.localizedValue] the locale specific value. + * @member {object} [properties] the set of pairs (usually a + * Dictionary) that includes details about the event. + * @member {object} [status] a string describing the status of the operation. + * Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + * @member {string} [status.value] the invariant value. + * @member {string} [status.localizedValue] the locale specific value. + * @member {object} [subStatus] the event sub status. Most of the time, when + * included, this captures the HTTP status code of the REST call. Common values + * are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted + * (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad + * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict + * (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), + * Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status + * Code: 504) + * @member {string} [subStatus.value] the invariant value. + * @member {string} [subStatus.localizedValue] the locale specific value. + * @member {date} [eventTimestamp] the timestamp of when the event was + * generated by the Azure service processing the request corresponding the + * event. It in ISO 8601 format. + * @member {date} [submissionTimestamp] the timestamp of when the event became + * available for querying via this API. It is in ISO 8601 format. This value + * should not be confused eventTimestamp. As there might be a delay between the + * occurrence time of the event, and the time that the event is submitted to + * the Azure logging infrastructure. + * @member {string} [subscriptionId] the Azure subscription Id usually a GUID. + * @member {string} [tenantId] the Azure tenant Id + */ +export interface EventData { + readonly authorization?: SenderAuthorization; + readonly claims?: { [propertyName: string]: string }; + readonly caller?: string; + readonly description?: string; + readonly id?: string; + readonly eventDataId?: string; + readonly correlationId?: string; + readonly eventName?: LocalizableString; + readonly category?: LocalizableString; + readonly httpRequest?: HttpRequestInfo; + readonly level?: string; + readonly resourceGroupName?: string; + readonly resourceProviderName?: LocalizableString; + readonly resourceId?: string; + readonly resourceType?: LocalizableString; + readonly operationId?: string; + readonly operationName?: LocalizableString; + readonly properties?: { [propertyName: string]: string }; + readonly status?: LocalizableString; + readonly subStatus?: LocalizableString; + readonly eventTimestamp?: Date; + readonly submissionTimestamp?: Date; + readonly subscriptionId?: string; + readonly tenantId?: string; +} + +/** + * @class + * Initializes a new instance of the MetricAvailability class. + * @constructor + * Metric availability specifies the time grain (aggregation interval or + * frequency) and the retention period for that time grain. + * + * @member {moment.duration} [timeGrain] the time grain specifies the + * aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', + * etc. + * @member {moment.duration} [retention] the retention period for the metric at + * the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + */ +export interface MetricAvailability { + timeGrain?: moment.Duration; + retention?: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the MetricDefinition class. + * @constructor + * Metric definition class specifies the metadata for a metric. + * + * @member {boolean} [isDimensionRequired] Flag to indicate whether the + * dimension is required. + * @member {string} [resourceId] the resource identifier of the resource that + * emitted the metric. + * @member {string} [namespace] the namespace the metric blongs to. + * @member {object} [name] the name and the display name of the metric, i.e. it + * is a localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [unit] the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {string} [primaryAggregationType] the primary aggregation type value + * defining how to use the values for display. Possible values include: 'None', + * 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + * @member {array} [supportedAggregationTypes] the collection of what + * aggregation types are supported. + * @member {array} [metricAvailabilities] the collection of what aggregation + * intervals are available to be queried. + * @member {string} [id] the resource identifier of the metric definition. + * @member {array} [dimensions] the name and the display name of the dimension, + * i.e. it is a localizable string. + */ +export interface MetricDefinition { + isDimensionRequired?: boolean; + resourceId?: string; + namespace?: string; + name?: LocalizableString; + unit?: string; + primaryAggregationType?: string; + supportedAggregationTypes?: string[]; + metricAvailabilities?: MetricAvailability[]; + id?: string; + dimensions?: LocalizableString[]; +} + +/** + * @class + * Initializes a new instance of the MetricValue class. + * @constructor + * Represents a metric value. + * + * @member {date} timeStamp the timestamp for the metric value in ISO 8601 + * format. + * @member {number} [average] the average value in the time range. + * @member {number} [minimum] the least value in the time range. + * @member {number} [maximum] the greatest value in the time range. + * @member {number} [total] the sum of all of the values in the time range. + * @member {number} [count] the number of samples in the time range. Can be + * used to determine the number of values that contributed to the average + * value. + */ +export interface MetricValue { + timeStamp: Date; + average?: number; + minimum?: number; + maximum?: number; + total?: number; + count?: number; +} + +/** + * @class + * Initializes a new instance of the MetadataValue class. + * @constructor + * Represents a metric metadata value. + * + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ +export interface MetadataValue { + name?: LocalizableString; + value?: string; +} + +/** + * @class + * Initializes a new instance of the TimeSeriesElement class. + * @constructor + * A time series result type. The discriminator value is always TimeSeries in + * this case. + * + * @member {array} [metadatavalues] the metadata values returned if $filter was + * specified in the call. + * @member {array} [data] An array of data points representing the metric + * values. This is only returned if a result type of data is specified. + */ +export interface TimeSeriesElement { + metadatavalues?: MetadataValue[]; + data?: MetricValue[]; +} + +/** + * @class + * Initializes a new instance of the Metric class. + * @constructor + * The result data of a query. + * + * @member {string} id the metric Id. + * @member {string} type the resource type of the metric resource. + * @member {object} name the name and the display name of the metric, i.e. it + * is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} unit the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {array} timeseries the time series returned when a data query is + * performed. + */ +export interface Metric { + id: string; + type: string; + name: LocalizableString; + unit: string; + timeseries: TimeSeriesElement[]; +} + +/** + * @class + * Initializes a new instance of the Response class. + * @constructor + * The response to a metrics query. + * + * @member {number} [cost] The integer value representing the cost of the + * query, for data case. + * @member {string} timespan The timespan for which the data was retrieved. Its + * value consists of two datatimes concatenated, separated by '/'. This may be + * adjusted in the future and returned back from what was originally requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if a + * metadata request was made. + * @member {string} [namespace] The namespace of the metrics been queried + * @member {string} [resourceregion] The region of the resource been queried + * for metrics. + * @member {array} value the value of the collection. + */ +export interface Response { + cost?: number; + timespan: string; + interval?: moment.Duration; + namespace?: string; + resourceregion?: string; + value: Metric[]; +} + +/** + * @class + * Initializes a new instance of the BaselineMetadataValue class. + * @constructor + * Represents a baseline metadata value. + * + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ +export interface BaselineMetadataValue { + name?: LocalizableString; + value?: string; +} + +/** + * @class + * Initializes a new instance of the Baseline class. + * @constructor + * The baseline values for a single sensitivity value. + * + * @member {string} sensitivity the sensitivity of the baseline. Possible + * values include: 'Low', 'Medium', 'High' + * @member {array} lowThresholds The low thresholds of the baseline. + * @member {array} highThresholds The high thresholds of the baseline. + */ +export interface Baseline { + sensitivity: string; + lowThresholds: number[]; + highThresholds: number[]; +} + +/** + * @class + * Initializes a new instance of the BaselineResponse class. + * @constructor + * The response to a baseline query. + * + * @member {string} [id] the metric baseline Id. + * @member {string} [type] the resource type of the baseline resource. + * @member {object} [name] the name and the display name of the metric, i.e. it + * is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [timespan] The timespan for which the data was retrieved. + * Its value consists of two datatimes concatenated, separated by '/'. This + * may be adjusted in the future and returned back from what was originally + * requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if a + * metadata request was made. + * @member {string} [aggregation] The aggregation type of the metric. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} [baseline] the baseline values for each sensitivity. + * @member {array} [metadata] the baseline metadata values. + */ +export interface BaselineResponse { + readonly id?: string; + readonly type?: string; + readonly name?: LocalizableString; + timespan?: string; + interval?: moment.Duration; + aggregation?: string; + timestamps?: Date[]; + baseline?: Baseline[]; + metadata?: BaselineMetadataValue[]; +} + +/** + * @class + * Initializes a new instance of the TimeSeriesInformation class. + * @constructor + * The time series info needed for calculating the baseline. + * + * @member {array} sensitivities the list of sensitivities for calculating the + * baseline. + * @member {array} values The metric values to calculate the baseline. + * @member {array} [timestamps] the array of timestamps of the baselines. + */ +export interface TimeSeriesInformation { + sensitivities: string[]; + values: number[]; + timestamps?: Date[]; +} + +/** + * @class + * Initializes a new instance of the CalculateBaselineResponse class. + * @constructor + * The response to a calcualte baseline call. + * + * @member {string} type the resource type of the baseline resource. + * @member {array} [timestamps] the array of timestamps of the baselines. + * @member {array} baseline the baseline values for each sensitivity. + */ +export interface CalculateBaselineResponse { + type: string; + timestamps?: Date[]; + baseline: Baseline[]; +} + +/** + * @class + * Initializes a new instance of the Action class. + * @constructor + * An alert action. + * + * @member {string} [actionGroupId] the id of the action group to use. + * @member {object} [webhookProperties] + */ +export interface Action { + actionGroupId?: string; + webhookProperties?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the MetricAlertCriteria class. + * @constructor + * The rule criteria that defines the conditions of the alert rule. + * + * @member {string} odatatype Polymorphic Discriminator + */ +export interface MetricAlertCriteria { + odatatype: string; + /** + * @property Describes unknown properties. The value of an unknown property + * can be of "any" type. + */ + [property: string]: any; +} + +/** + * @class + * Initializes a new instance of the MetricAlertResource class. + * @constructor + * The metric alert resource. + * + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert is + * scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert is + * evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface MetricAlertResource extends Resource { + description: string; + severity: number; + enabled: boolean; + scopes?: string[]; + evaluationFrequency: moment.Duration; + windowSize: moment.Duration; + criteria: MetricAlertCriteria; + actions?: Action[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the MetricAlertResourcePatch class. + * @constructor + * The metric alert resource for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert is + * scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert is + * evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ +export interface MetricAlertResourcePatch { + tags?: { [propertyName: string]: string }; + description: string; + severity: number; + enabled: boolean; + scopes?: string[]; + evaluationFrequency: moment.Duration; + windowSize: moment.Duration; + criteria: MetricAlertCriteria; + actions?: Action[]; + readonly lastUpdatedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the MetricAlertStatusProperties class. + * @constructor + * An alert status properties. + * + * @member {object} [dimensions] + * @member {string} [status] status value + * @member {date} [timestamp] UTC time when the status was checked. + */ +export interface MetricAlertStatusProperties { + dimensions?: { [propertyName: string]: string }; + status?: string; + timestamp?: Date; +} + +/** + * @class + * Initializes a new instance of the MetricAlertStatus class. + * @constructor + * An alert status. + * + * @member {string} [name] The status name. + * @member {string} [id] The alert rule arm id. + * @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 {string} [properties.status] status value + * @member {date} [properties.timestamp] UTC time when the status was checked. + */ +export interface MetricAlertStatus { + name?: string; + id?: string; + type?: string; + properties?: MetricAlertStatusProperties; +} + +/** + * @class + * Initializes a new instance of the MetricAlertStatusCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + * @member {array} [value] the values for the alert rule resources. + */ +export interface MetricAlertStatusCollection { + value?: MetricAlertStatus[]; +} + +/** + * @class + * Initializes a new instance of the MetricDimension class. + * @constructor + * @member {string} name Name of the dimension. + * @member {string} operator the dimension operator. + * @member {array} values list of dimension values. + */ +export interface MetricDimension { + name: string; + operator: string; + values: string[]; +} + +/** + * @class + * Initializes a new instance of the MetricCriteria class. + * @constructor + * @member {string} name Name of the criteria. + * @member {string} metricName Name of the metric. + * @member {string} [metricNamespace] Namespace of the metric. + * @member {object} operator the criteria operator. + * @member {object} timeAggregation the criteria time aggregation types. + * @member {number} threshold the criteria threshold value that activates the + * alert. + * @member {array} [dimensions] List of dimension conditions. + */ +export interface MetricCriteria { + name: string; + metricName: string; + metricNamespace?: string; + operator: any; + timeAggregation: any; + threshold: number; + dimensions?: MetricDimension[]; +} + +/** + * @class + * Initializes a new instance of the MetricAlertSingleResourceMultipleMetricCriteria class. + * @constructor + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + * + * @member {array} [allOf] The list of metric criteria for this 'all of' + * operation. + */ +export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + allOf?: MetricCriteria[]; +} + + +/** + * @class + * Initializes a new instance of the AutoscaleSettingResourceCollection class. + * @constructor + * Represents a collection of autoscale setting resources. + * + * @member {string} [nextLink] URL to get the next set of results. + */ +export interface AutoscaleSettingResourceCollection extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the IncidentListResult class. + * @constructor + * The List incidents operation response. + * + */ +export interface IncidentListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the AlertRuleResourceCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + */ +export interface AlertRuleResourceCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the LogProfileCollection class. + * @constructor + * Represents a collection of log profiles. + * + */ +export interface LogProfileCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the ActionGroupList class. + * @constructor + * A list of action groups. + * + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ +export interface ActionGroupList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ActivityLogAlertList class. + * @constructor + * A list of activity log alerts. + * + * @member {string} [nextLink] Provides the link to retrieve the next set of + * elements. + */ +export interface ActivityLogAlertList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EventDataCollection class. + * @constructor + * Represents collection of events. + * + * @member {string} [nextLink] Provides the link to retrieve the next set of + * events. + */ +export interface EventDataCollection extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EventCategoryCollection class. + * @constructor + * A collection of event categories. Currently possible values are: + * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + */ +export interface EventCategoryCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the MetricDefinitionCollection class. + * @constructor + * Represents collection of metric definitions. + * + */ +export interface MetricDefinitionCollection extends Array { +} + +/** + * @class + * Initializes a new instance of the MetricAlertResourceCollection class. + * @constructor + * Represents a collection of alert rule resources. + * + */ +export interface MetricAlertResourceCollection extends Array { +} diff --git a/lib/services/monitor/lib/lib/models/index.js b/lib/services/monitor/lib/lib/models/index.js new file mode 100644 index 0000000000..878adabbd3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/index.js @@ -0,0 +1,131 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.Resource = require('./resource'); +exports.ScaleCapacity = require('./scaleCapacity'); +exports.MetricTrigger = require('./metricTrigger'); +exports.ScaleAction = require('./scaleAction'); +exports.ScaleRule = require('./scaleRule'); +exports.TimeWindow = require('./timeWindow'); +exports.RecurrentSchedule = require('./recurrentSchedule'); +exports.Recurrence = require('./recurrence'); +exports.AutoscaleProfile = require('./autoscaleProfile'); +exports.EmailNotification = require('./emailNotification'); +exports.WebhookNotification = require('./webhookNotification'); +exports.AutoscaleNotification = require('./autoscaleNotification'); +exports.AutoscaleSettingResource = require('./autoscaleSettingResource'); +exports.AutoscaleSettingResourcePatch = require('./autoscaleSettingResourcePatch'); +exports.ErrorResponse = require('./errorResponse'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.OperationListResult = require('./operationListResult'); +exports.Incident = require('./incident'); +exports.RuleDataSource = require('./ruleDataSource'); +exports.RuleCondition = require('./ruleCondition'); +exports.RuleMetricDataSource = require('./ruleMetricDataSource'); +exports.RuleManagementEventClaimsDataSource = require('./ruleManagementEventClaimsDataSource'); +exports.RuleManagementEventDataSource = require('./ruleManagementEventDataSource'); +exports.ThresholdRuleCondition = require('./thresholdRuleCondition'); +exports.LocationThresholdRuleCondition = require('./locationThresholdRuleCondition'); +exports.ManagementEventAggregationCondition = require('./managementEventAggregationCondition'); +exports.ManagementEventRuleCondition = require('./managementEventRuleCondition'); +exports.RuleAction = require('./ruleAction'); +exports.RuleEmailAction = require('./ruleEmailAction'); +exports.RuleWebhookAction = require('./ruleWebhookAction'); +exports.AlertRuleResource = require('./alertRuleResource'); +exports.AlertRuleResourcePatch = require('./alertRuleResourcePatch'); +exports.RetentionPolicy = require('./retentionPolicy'); +exports.LogProfileResource = require('./logProfileResource'); +exports.LogProfileResourcePatch = require('./logProfileResourcePatch'); +exports.ProxyOnlyResource = require('./proxyOnlyResource'); +exports.MetricSettings = require('./metricSettings'); +exports.LogSettings = require('./logSettings'); +exports.DiagnosticSettingsResource = require('./diagnosticSettingsResource'); +exports.DiagnosticSettingsResourceCollection = require('./diagnosticSettingsResourceCollection'); +exports.DiagnosticSettingsCategoryResource = require('./diagnosticSettingsCategoryResource'); +exports.DiagnosticSettingsCategoryResourceCollection = require('./diagnosticSettingsCategoryResourceCollection'); +exports.EmailReceiver = require('./emailReceiver'); +exports.SmsReceiver = require('./smsReceiver'); +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'); +exports.ActivityLogAlertLeafCondition = require('./activityLogAlertLeafCondition'); +exports.ActivityLogAlertAllOfCondition = require('./activityLogAlertAllOfCondition'); +exports.ActivityLogAlertActionGroup = require('./activityLogAlertActionGroup'); +exports.ActivityLogAlertActionList = require('./activityLogAlertActionList'); +exports.ActivityLogAlertResource = require('./activityLogAlertResource'); +exports.ActivityLogAlertPatchBody = require('./activityLogAlertPatchBody'); +exports.LocalizableString = require('./localizableString'); +exports.SenderAuthorization = require('./senderAuthorization'); +exports.HttpRequestInfo = require('./httpRequestInfo'); +exports.EventData = require('./eventData'); +exports.MetricAvailability = require('./metricAvailability'); +exports.MetricDefinition = require('./metricDefinition'); +exports.MetricValue = require('./metricValue'); +exports.MetadataValue = require('./metadataValue'); +exports.TimeSeriesElement = require('./timeSeriesElement'); +exports.Metric = require('./metric'); +exports.Response = require('./response'); +exports.BaselineMetadataValue = require('./baselineMetadataValue'); +exports.Baseline = require('./baseline'); +exports.BaselineResponse = require('./baselineResponse'); +exports.TimeSeriesInformation = require('./timeSeriesInformation'); +exports.CalculateBaselineResponse = require('./calculateBaselineResponse'); +exports.Action = require('./action'); +exports.MetricAlertCriteria = require('./metricAlertCriteria'); +exports.MetricAlertResource = require('./metricAlertResource'); +exports.MetricAlertResourcePatch = require('./metricAlertResourcePatch'); +exports.MetricAlertStatusProperties = require('./metricAlertStatusProperties'); +exports.MetricAlertStatus = require('./metricAlertStatus'); +exports.MetricAlertStatusCollection = require('./metricAlertStatusCollection'); +exports.MetricDimension = require('./metricDimension'); +exports.MetricCriteria = require('./metricCriteria'); +exports.MetricAlertSingleResourceMultipleMetricCriteria = require('./metricAlertSingleResourceMultipleMetricCriteria'); +exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); +exports.IncidentListResult = require('./incidentListResult'); +exports.AlertRuleResourceCollection = require('./alertRuleResourceCollection'); +exports.LogProfileCollection = require('./logProfileCollection'); +exports.ActionGroupList = require('./actionGroupList'); +exports.ActivityLogAlertList = require('./activityLogAlertList'); +exports.EventDataCollection = require('./eventDataCollection'); +exports.EventCategoryCollection = require('./eventCategoryCollection'); +exports.MetricDefinitionCollection = require('./metricDefinitionCollection'); +exports.MetricAlertResourceCollection = require('./metricAlertResourceCollection'); +exports.discriminators = { + 'RuleDataSource' : exports.RuleDataSource, + 'RuleCondition' : exports.RuleCondition, + 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' : exports.RuleMetricDataSource, + 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' : exports.RuleManagementEventDataSource, + 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' : exports.ThresholdRuleCondition, + 'RuleCondition.Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' : exports.LocationThresholdRuleCondition, + 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' : exports.ManagementEventRuleCondition, + 'RuleAction' : exports.RuleAction, + '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 +}; diff --git a/lib/services/monitor/lib/lib/models/itsmReceiver.js b/lib/services/monitor/lib/lib/models/itsmReceiver.js new file mode 100644 index 0000000000..a46c94b4d3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/itsmReceiver.js @@ -0,0 +1,89 @@ +/* + * 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 Itsm receiver. + * + */ +class ItsmReceiver { + /** + * Create a ItsmReceiver. + * @member {string} name The name of the Itsm receiver. Names must be unique + * across all receivers within an action group. + * @member {string} workspaceId OMS LA instance identifier. + * @member {string} connectionId Unique identification of ITSM connection + * among multiple defined in above workspace. + * @member {string} ticketConfiguration JSON blob for the configurations of + * the ITSM action. CreateMultipleWorkItems option will be part of this blob + * as well. + * @member {string} region Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + */ + constructor() { + } + + /** + * Defines the metadata of ItsmReceiver + * + * @returns {object} metadata of ItsmReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'ItsmReceiver', + type: { + name: 'Composite', + className: 'ItsmReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + workspaceId: { + required: true, + serializedName: 'workspaceId', + type: { + name: 'String' + } + }, + connectionId: { + required: true, + serializedName: 'connectionId', + type: { + name: 'String' + } + }, + ticketConfiguration: { + required: true, + serializedName: 'ticketConfiguration', + type: { + name: 'String' + } + }, + region: { + required: true, + serializedName: 'region', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ItsmReceiver; diff --git a/lib/services/monitor/lib/lib/models/localizableString.js b/lib/services/monitor/lib/lib/models/localizableString.js new file mode 100644 index 0000000000..357dc90351 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/localizableString.js @@ -0,0 +1,60 @@ +/* + * 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 localizable string class. + * + */ +class LocalizableString { + /** + * Create a LocalizableString. + * @member {string} value the invariant value. + * @member {string} [localizedValue] the locale specific value. + */ + constructor() { + } + + /** + * Defines the metadata of LocalizableString + * + * @returns {object} metadata of LocalizableString + * + */ + mapper() { + return { + required: false, + serializedName: 'LocalizableString', + type: { + name: 'Composite', + className: 'LocalizableString', + modelProperties: { + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + }, + localizedValue: { + required: false, + serializedName: 'localizedValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LocalizableString; diff --git a/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js new file mode 100644 index 0000000000..c432f200c8 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js @@ -0,0 +1,96 @@ +/* + * 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'); + +/** + * A rule condition based on a certain number of locations failing. + * + * @extends models['RuleCondition'] + */ +class LocationThresholdRuleCondition extends models['RuleCondition'] { + /** + * Create a LocationThresholdRuleCondition. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {number} failedLocationCount the number of locations that must + * fail to activate the alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LocationThresholdRuleCondition + * + * @returns {object} metadata of LocationThresholdRuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'LocationThresholdRuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + windowSize: { + required: false, + serializedName: 'windowSize', + type: { + name: 'TimeSpan' + } + }, + failedLocationCount: { + required: true, + serializedName: 'failedLocationCount', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = LocationThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/logProfileCollection.js b/lib/services/monitor/lib/lib/models/logProfileCollection.js new file mode 100644 index 0000000000..d2530db617 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logProfileCollection.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 profiles. + */ +class LogProfileCollection extends Array { + /** + * Create a LogProfileCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogProfileCollection + * + * @returns {object} metadata of LogProfileCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'LogProfileCollection', + type: { + name: 'Composite', + className: 'LogProfileCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogProfileResourceElementType', + type: { + name: 'Composite', + className: 'LogProfileResource' + } + } + } + } + } + } + }; + } +} + +module.exports = LogProfileCollection; diff --git a/lib/services/monitor/lib/lib/models/logProfileResource.js b/lib/services/monitor/lib/lib/models/logProfileResource.js new file mode 100644 index 0000000000..69a8f54034 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logProfileResource.js @@ -0,0 +1,161 @@ +/* + * 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 profile resource. + * + * @extends models['Resource'] + */ +class LogProfileResource extends models['Resource'] { + /** + * Create a LogProfileResource. + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories + * are created as is convenient to the user. Some values are: 'Write', + * 'Delete', and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in + * the log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogProfileResource + * + * @returns {object} metadata of LogProfileResource + * + */ + mapper() { + return { + required: false, + serializedName: 'LogProfileResource', + type: { + name: 'Composite', + className: 'LogProfileResource', + 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' + } + } + } + }, + storageAccountId: { + required: false, + serializedName: 'properties.storageAccountId', + type: { + name: 'String' + } + }, + serviceBusRuleId: { + required: false, + serializedName: 'properties.serviceBusRuleId', + type: { + name: 'String' + } + }, + locations: { + required: true, + serializedName: 'properties.locations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + categories: { + required: true, + serializedName: 'properties.categories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + retentionPolicy: { + required: true, + serializedName: 'properties.retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = LogProfileResource; diff --git a/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js b/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js new file mode 100644 index 0000000000..f9b2822b45 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js @@ -0,0 +1,129 @@ +/* + * 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 profile resource for patch operations. + * + */ +class LogProfileResourcePatch { + /** + * Create a LogProfileResourcePatch. + * @member {object} [tags] Resource tags + * @member {string} [storageAccountId] the resource id of the storage account + * to which you would like to send the Activity Log. + * @member {string} [serviceBusRuleId] The service bus rule ID of the service + * bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * @member {array} locations List of regions for which Activity Log events + * should be stored or streamed. It is a comma separated list of valid ARM + * locations including the 'global' location. + * @member {array} categories the categories of the logs. These categories + * are created as is convenient to the user. Some values are: 'Write', + * 'Delete', and/or 'Action.' + * @member {object} retentionPolicy the retention policy for the events in + * the log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of LogProfileResourcePatch + * + * @returns {object} metadata of LogProfileResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'LogProfileResourcePatch', + type: { + name: 'Composite', + className: 'LogProfileResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + storageAccountId: { + required: false, + serializedName: 'properties.storageAccountId', + type: { + name: 'String' + } + }, + serviceBusRuleId: { + required: false, + serializedName: 'properties.serviceBusRuleId', + type: { + name: 'String' + } + }, + locations: { + required: true, + serializedName: 'properties.locations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + categories: { + required: true, + serializedName: 'properties.categories', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + retentionPolicy: { + required: true, + serializedName: 'properties.retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = LogProfileResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/logSettings.js b/lib/services/monitor/lib/lib/models/logSettings.js new file mode 100644 index 0000000000..de7aa7b6c6 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/logSettings.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'; + +const models = require('./index'); + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular log. + * + */ +class LogSettings { + /** + * Create a LogSettings. + * @member {string} [category] Name of a Diagnostic Log category for a + * resource type this setting is applied to. To obtain the list of Diagnostic + * Log categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this log is enabled. + * @member {object} [retentionPolicy] the retention policy for this log. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of LogSettings + * + * @returns {object} metadata of LogSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSettings', + type: { + name: 'Composite', + className: 'LogSettings', + modelProperties: { + category: { + required: false, + serializedName: 'category', + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + retentionPolicy: { + required: false, + serializedName: 'retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = LogSettings; diff --git a/lib/services/monitor/lib/lib/models/logicAppReceiver.js b/lib/services/monitor/lib/lib/models/logicAppReceiver.js new file mode 100644 index 0000000000..9e7a9f1a52 --- /dev/null +++ b/lib/services/monitor/lib/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/monitor/lib/lib/models/managementEventAggregationCondition.js b/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js new file mode 100644 index 0000000000..29aa3f55f9 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * How the data that is collected should be combined over time. + * + */ +class ManagementEventAggregationCondition { + /** + * Create a ManagementEventAggregationCondition. + * @member {string} [operator] the condition operator. Possible values + * include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [threshold] The threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + */ + constructor() { + } + + /** + * Defines the metadata of ManagementEventAggregationCondition + * + * @returns {object} metadata of ManagementEventAggregationCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementEventAggregationCondition', + type: { + name: 'Composite', + className: 'ManagementEventAggregationCondition', + modelProperties: { + operator: { + required: false, + serializedName: 'operator', + type: { + name: 'Enum', + allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] + } + }, + threshold: { + required: false, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + windowSize: { + required: false, + serializedName: 'windowSize', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = ManagementEventAggregationCondition; diff --git a/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js b/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js new file mode 100644 index 0000000000..d06bfc5742 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js @@ -0,0 +1,94 @@ +/* + * 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'); + +/** + * A management event rule condition. + * + * @extends models['RuleCondition'] + */ +class ManagementEventRuleCondition extends models['RuleCondition'] { + /** + * Create a ManagementEventRuleCondition. + * @member {object} [aggregation] How the data that is collected should be + * combined over time and when the alert is activated. Note that for + * management event alerts aggregation is optional – if it is not provided + * then any event will cause the alert to activate. + * @member {string} [aggregation.operator] the condition operator. Possible + * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [aggregation.threshold] The threshold value that + * activates the alert. + * @member {moment.duration} [aggregation.windowSize] the period of time (in + * ISO 8601 duration format) that is used to monitor alert activity based on + * the threshold. If specified then it must be between 5 minutes and 1 day. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagementEventRuleCondition + * + * @returns {object} metadata of ManagementEventRuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'ManagementEventRuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + aggregation: { + required: false, + serializedName: 'aggregation', + type: { + name: 'Composite', + className: 'ManagementEventAggregationCondition' + } + } + } + } + }; + } +} + +module.exports = ManagementEventRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/metadataValue.js b/lib/services/monitor/lib/lib/models/metadataValue.js new file mode 100644 index 0000000000..e57162fef2 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metadataValue.js @@ -0,0 +1,65 @@ +/* + * 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'); + +/** + * Represents a metric metadata value. + * + */ +class MetadataValue { + /** + * Create a MetadataValue. + * @member {object} [name] the name of the metadata. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [value] the value of the metadata. + */ + constructor() { + } + + /** + * Defines the metadata of MetadataValue + * + * @returns {object} metadata of MetadataValue + * + */ + mapper() { + return { + required: false, + serializedName: 'MetadataValue', + type: { + name: 'Composite', + className: 'MetadataValue', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MetadataValue; diff --git a/lib/services/monitor/lib/lib/models/metric.js b/lib/services/monitor/lib/lib/models/metric.js new file mode 100644 index 0000000000..62f4e00afc --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metric.js @@ -0,0 +1,102 @@ +/* + * 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 result data of a query. + * + */ +class Metric { + /** + * Create a Metric. + * @member {string} id the metric Id. + * @member {string} type the resource type of the metric resource. + * @member {object} name the name and the display name of the metric, i.e. it + * is localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} unit the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {array} timeseries the time series returned when a data query is + * performed. + */ + constructor() { + } + + /** + * Defines the metadata of Metric + * + * @returns {object} metadata of Metric + * + */ + mapper() { + return { + required: false, + serializedName: 'Metric', + type: { + name: 'Composite', + className: 'Metric', + modelProperties: { + id: { + required: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + unit: { + required: true, + serializedName: 'unit', + type: { + name: 'Enum', + allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] + } + }, + timeseries: { + required: true, + serializedName: 'timeseries', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TimeSeriesElementElementType', + type: { + name: 'Composite', + className: 'TimeSeriesElement' + } + } + } + } + } + } + }; + } +} + +module.exports = Metric; diff --git a/lib/services/monitor/lib/lib/models/metricAlertCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertCriteria.js new file mode 100644 index 0000000000..1a423dbb2d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertCriteria.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'; + +/** + * The rule criteria that defines the conditions of the alert rule. + * + */ +class MetricAlertCriteria { + /** + * Create a MetricAlertCriteria. + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertCriteria + * + * @returns {object} metadata of MetricAlertCriteria + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertCriteria', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + }, + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertCriteria', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MetricAlertCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResource.js b/lib/services/monitor/lib/lib/models/metricAlertResource.js new file mode 100644 index 0000000000..c21174220c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertResource.js @@ -0,0 +1,208 @@ +/* + * 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 metric alert resource. + * + * @extends models['Resource'] + */ +class MetricAlertResource extends models['Resource'] { + /** + * Create a MetricAlertResource. + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert + * is scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert + * is evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricAlertResource + * + * @returns {object} metadata of MetricAlertResource + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertResource', + type: { + name: 'Composite', + className: 'MetricAlertResource', + 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: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + severity: { + required: true, + serializedName: 'properties.severity', + type: { + name: 'Number' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + type: { + name: 'Boolean' + } + }, + scopes: { + required: false, + serializedName: 'properties.scopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + evaluationFrequency: { + required: true, + serializedName: 'properties.evaluationFrequency', + type: { + name: 'TimeSpan' + } + }, + windowSize: { + required: true, + serializedName: 'properties.windowSize', + type: { + name: 'TimeSpan' + } + }, + criteria: { + required: true, + serializedName: 'properties.criteria', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + }, + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertCriteria' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + className: 'Action' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = MetricAlertResource; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js b/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js new file mode 100644 index 0000000000..4e54250e8c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.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 alert rule resources. + */ +class MetricAlertResourceCollection extends Array { + /** + * Create a MetricAlertResourceCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricAlertResourceCollection + * + * @returns {object} metadata of MetricAlertResourceCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertResourceCollection', + type: { + name: 'Composite', + className: 'MetricAlertResourceCollection', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAlertResourceElementType', + type: { + name: 'Composite', + className: 'MetricAlertResource' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js b/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js new file mode 100644 index 0000000000..1832373f2d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js @@ -0,0 +1,176 @@ +/* + * 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 metric alert resource for patch operations. + * + */ +class MetricAlertResourcePatch { + /** + * Create a MetricAlertResourcePatch. + * @member {object} [tags] Resource tags + * @member {string} description the description of the metric alert that will + * be included in the alert email. + * @member {number} severity Alert severity {0, 1, 2, 3, 4} + * @member {boolean} enabled the flag that indicates whether the metric alert + * is enabled. + * @member {array} [scopes] the list of resource id's that this metric alert + * is scoped to. + * @member {moment.duration} evaluationFrequency how often the metric alert + * is evaluated represented in ISO 8601 duration format. + * @member {moment.duration} windowSize the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. + * @member {object} criteria defines the specific alert criteria information. + * @member {string} [criteria.odatatype] Polymorphic Discriminator + * @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 + * format. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertResourcePatch + * + * @returns {object} metadata of MetricAlertResourcePatch + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertResourcePatch', + type: { + name: 'Composite', + className: 'MetricAlertResourcePatch', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + description: { + required: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + severity: { + required: true, + serializedName: 'properties.severity', + type: { + name: 'Number' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + type: { + name: 'Boolean' + } + }, + scopes: { + required: false, + serializedName: 'properties.scopes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + evaluationFrequency: { + required: true, + serializedName: 'properties.evaluationFrequency', + type: { + name: 'TimeSpan' + } + }, + windowSize: { + required: true, + serializedName: 'properties.windowSize', + type: { + name: 'TimeSpan' + } + }, + criteria: { + required: true, + serializedName: 'properties.criteria', + type: { + name: 'Composite', + additionalProperties: { + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + }, + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertCriteria' + } + }, + actions: { + required: false, + serializedName: 'properties.actions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + className: 'Action' + } + } + } + }, + lastUpdatedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastUpdatedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = MetricAlertResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js new file mode 100644 index 0000000000..99a72bf055 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.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'; + +const models = require('./index'); + +/** + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + * + * @extends models['MetricAlertCriteria'] + */ +class MetricAlertSingleResourceMultipleMetricCriteria extends models['MetricAlertCriteria'] { + /** + * Create a MetricAlertSingleResourceMultipleMetricCriteria. + * @member {array} [allOf] The list of metric criteria for this 'all of' + * operation. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricAlertSingleResourceMultipleMetricCriteria + * + * @returns {object} metadata of MetricAlertSingleResourceMultipleMetricCriteria + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'MetricAlertCriteria', + className: 'MetricAlertSingleResourceMultipleMetricCriteria', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + allOf: { + required: false, + serializedName: 'allOf', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricCriteriaElementType', + type: { + name: 'Composite', + className: 'MetricCriteria' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertSingleResourceMultipleMetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatus.js b/lib/services/monitor/lib/lib/models/metricAlertStatus.js new file mode 100644 index 0000000000..6df29691be --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertStatus.js @@ -0,0 +1,84 @@ +/* + * 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'); + +/** + * An alert status. + * + */ +class MetricAlertStatus { + /** + * Create a MetricAlertStatus. + * @member {string} [name] The status name. + * @member {string} [id] The alert rule arm id. + * @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 {string} [properties.status] status value + * @member {date} [properties.timestamp] UTC time when the status was + * checked. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertStatus + * + * @returns {object} metadata of MetricAlertStatus + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertStatus', + type: { + name: 'Composite', + className: 'MetricAlertStatus', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'MetricAlertStatusProperties' + } + } + } + } + }; + } +} + +module.exports = MetricAlertStatus; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js b/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js new file mode 100644 index 0000000000..e3679d730b --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js @@ -0,0 +1,62 @@ +/* + * 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'); + +/** + * Represents a collection of alert rule resources. + * + */ +class MetricAlertStatusCollection { + /** + * Create a MetricAlertStatusCollection. + * @member {array} [value] the values for the alert rule resources. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertStatusCollection + * + * @returns {object} metadata of MetricAlertStatusCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertStatusCollection', + type: { + name: 'Composite', + className: 'MetricAlertStatusCollection', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAlertStatusElementType', + type: { + name: 'Composite', + className: 'MetricAlertStatus' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricAlertStatusCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js b/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js new file mode 100644 index 0000000000..b9581c6cda --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js @@ -0,0 +1,75 @@ +/* + * 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 status properties. + * + */ +class MetricAlertStatusProperties { + /** + * Create a MetricAlertStatusProperties. + * @member {object} [dimensions] + * @member {string} [status] status value + * @member {date} [timestamp] UTC time when the status was checked. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAlertStatusProperties + * + * @returns {object} metadata of MetricAlertStatusProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAlertStatusProperties', + type: { + name: 'Composite', + className: 'MetricAlertStatusProperties', + modelProperties: { + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + timestamp: { + required: false, + serializedName: 'timestamp', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = MetricAlertStatusProperties; diff --git a/lib/services/monitor/lib/lib/models/metricAvailability.js b/lib/services/monitor/lib/lib/models/metricAvailability.js new file mode 100644 index 0000000000..b8374a22c0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricAvailability.js @@ -0,0 +1,64 @@ +/* + * 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'; + +/** + * Metric availability specifies the time grain (aggregation interval or + * frequency) and the retention period for that time grain. + * + */ +class MetricAvailability { + /** + * Create a MetricAvailability. + * @member {moment.duration} [timeGrain] the time grain specifies the + * aggregation interval for the metric. Expressed as a duration 'PT1M', + * 'P1D', etc. + * @member {moment.duration} [retention] the retention period for the metric + * at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + */ + constructor() { + } + + /** + * Defines the metadata of MetricAvailability + * + * @returns {object} metadata of MetricAvailability + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricAvailability', + type: { + name: 'Composite', + className: 'MetricAvailability', + modelProperties: { + timeGrain: { + required: false, + serializedName: 'timeGrain', + type: { + name: 'TimeSpan' + } + }, + retention: { + required: false, + serializedName: 'retention', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = MetricAvailability; diff --git a/lib/services/monitor/lib/lib/models/metricCriteria.js b/lib/services/monitor/lib/lib/models/metricCriteria.js new file mode 100644 index 0000000000..19192dc18a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricCriteria.js @@ -0,0 +1,110 @@ +/* + * 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'); + +/** + * Class representing a MetricCriteria. + */ +class MetricCriteria { + /** + * Create a MetricCriteria. + * @member {string} name Name of the criteria. + * @member {string} metricName Name of the metric. + * @member {string} [metricNamespace] Namespace of the metric. + * @member {object} operator the criteria operator. + * @member {object} timeAggregation the criteria time aggregation types. + * @member {number} threshold the criteria threshold value that activates the + * alert. + * @member {array} [dimensions] List of dimension conditions. + */ + constructor() { + } + + /** + * Defines the metadata of MetricCriteria + * + * @returns {object} metadata of MetricCriteria + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricCriteria', + type: { + name: 'Composite', + className: 'MetricCriteria', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + metricName: { + required: true, + serializedName: 'metricName', + type: { + name: 'String' + } + }, + metricNamespace: { + required: false, + serializedName: 'metricNamespace', + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'Object' + } + }, + timeAggregation: { + required: true, + serializedName: 'timeAggregation', + type: { + name: 'Object' + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricDimensionElementType', + type: { + name: 'Composite', + className: 'MetricDimension' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricDefinition.js b/lib/services/monitor/lib/lib/models/metricDefinition.js new file mode 100644 index 0000000000..06e73cee86 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricDefinition.js @@ -0,0 +1,165 @@ +/* + * 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'); + +/** + * Metric definition class specifies the metadata for a metric. + * + */ +class MetricDefinition { + /** + * Create a MetricDefinition. + * @member {boolean} [isDimensionRequired] Flag to indicate whether the + * dimension is required. + * @member {string} [resourceId] the resource identifier of the resource that + * emitted the metric. + * @member {string} [namespace] the namespace the metric blongs to. + * @member {object} [name] the name and the display name of the metric, i.e. + * it is a localizable string. + * @member {string} [name.value] the invariant value. + * @member {string} [name.localizedValue] the locale specific value. + * @member {string} [unit] the unit of the metric. Possible values include: + * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', + * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' + * @member {string} [primaryAggregationType] the primary aggregation type + * value defining how to use the values for display. Possible values include: + * 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' + * @member {array} [supportedAggregationTypes] the collection of what + * aggregation types are supported. + * @member {array} [metricAvailabilities] the collection of what aggregation + * intervals are available to be queried. + * @member {string} [id] the resource identifier of the metric definition. + * @member {array} [dimensions] the name and the display name of the + * dimension, i.e. it is a localizable string. + */ + constructor() { + } + + /** + * Defines the metadata of MetricDefinition + * + * @returns {object} metadata of MetricDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDefinition', + type: { + name: 'Composite', + className: 'MetricDefinition', + modelProperties: { + isDimensionRequired: { + required: false, + serializedName: 'isDimensionRequired', + type: { + name: 'Boolean' + } + }, + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + namespace: { + required: false, + serializedName: 'namespace', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'LocalizableString' + } + }, + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'Enum', + allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] + } + }, + primaryAggregationType: { + required: false, + serializedName: 'primaryAggregationType', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] + } + }, + supportedAggregationTypes: { + required: false, + serializedName: 'supportedAggregationTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AggregationTypeElementType', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] + } + } + } + }, + metricAvailabilities: { + required: false, + serializedName: 'metricAvailabilities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricAvailabilityElementType', + type: { + name: 'Composite', + className: 'MetricAvailability' + } + } + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LocalizableStringElementType', + type: { + name: 'Composite', + className: 'LocalizableString' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricDefinition; diff --git a/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js b/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js new file mode 100644 index 0000000000..e6466e922a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricDefinitionCollection.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 collection of metric definitions. + */ +class MetricDefinitionCollection extends Array { + /** + * Create a MetricDefinitionCollection. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of MetricDefinitionCollection + * + * @returns {object} metadata of MetricDefinitionCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDefinitionCollection', + type: { + name: 'Composite', + className: 'MetricDefinitionCollection', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricDefinitionElementType', + type: { + name: 'Composite', + className: 'MetricDefinition' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricDefinitionCollection; diff --git a/lib/services/monitor/lib/lib/models/metricDimension.js b/lib/services/monitor/lib/lib/models/metricDimension.js new file mode 100644 index 0000000000..4805da9870 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricDimension.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a MetricDimension. + */ +class MetricDimension { + /** + * Create a MetricDimension. + * @member {string} name Name of the dimension. + * @member {string} operator the dimension operator. + * @member {array} values list of dimension values. + */ + constructor() { + } + + /** + * Defines the metadata of MetricDimension + * + * @returns {object} metadata of MetricDimension + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricDimension', + type: { + name: 'Composite', + className: 'MetricDimension', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'String' + } + }, + values: { + required: true, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = MetricDimension; diff --git a/lib/services/monitor/lib/lib/models/metricSettings.js b/lib/services/monitor/lib/lib/models/metricSettings.js new file mode 100644 index 0000000000..bdde9809ff --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricSettings.js @@ -0,0 +1,89 @@ +/* + * 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'); + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular metric. + * + */ +class MetricSettings { + /** + * Create a MetricSettings. + * @member {moment.duration} [timeGrain] the timegrain of the metric in + * ISO8601 format. + * @member {string} [category] Name of a Diagnostic Metric category for a + * resource type this setting is applied to. To obtain the list of Diagnostic + * metric categories for a resource, first perform a GET diagnostic settings + * operation. + * @member {boolean} enabled a value indicating whether this category is + * enabled. + * @member {object} [retentionPolicy] the retention policy for this category. + * @member {boolean} [retentionPolicy.enabled] a value indicating whether the + * retention policy is enabled. + * @member {number} [retentionPolicy.days] the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of MetricSettings + * + * @returns {object} metadata of MetricSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricSettings', + type: { + name: 'Composite', + className: 'MetricSettings', + modelProperties: { + timeGrain: { + required: false, + serializedName: 'timeGrain', + type: { + name: 'TimeSpan' + } + }, + category: { + required: false, + serializedName: 'category', + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + retentionPolicy: { + required: false, + serializedName: 'retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy' + } + } + } + } + }; + } +} + +module.exports = MetricSettings; diff --git a/lib/services/monitor/lib/lib/models/metricTrigger.js b/lib/services/monitor/lib/lib/models/metricTrigger.js new file mode 100644 index 0000000000..09e76603e5 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricTrigger.js @@ -0,0 +1,125 @@ +/* + * 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 trigger that results in a scaling action. + * + */ +class MetricTrigger { + /** + * Create a MetricTrigger. + * @member {string} metricName the name of the metric that defines what the + * rule monitors. + * @member {string} metricResourceUri the resource identifier of the resource + * the rule monitors. + * @member {moment.duration} timeGrain the granularity of metrics the rule + * monitors. Must be one of the predefined values returned from metric + * definitions for the metric. Must be between 12 hours and 1 minute. + * @member {string} statistic the metric statistic type. How the metrics from + * multiple instances are combined. Possible values include: 'Average', + * 'Min', 'Max', 'Sum' + * @member {moment.duration} timeWindow the range of time in which instance + * data is collected. This value must be greater than the delay in metric + * collection, which can vary from resource-to-resource. Must be between 12 + * hours and 5 minutes. + * @member {string} timeAggregation time aggregation type. How the data that + * is collected should be combined over time. The default value is Average. + * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' + * @member {string} operator the operator that is used to compare the metric + * data and the threshold. Possible values include: 'Equals', 'NotEquals', + * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold of the metric that triggers the + * scale action. + */ + constructor() { + } + + /** + * Defines the metadata of MetricTrigger + * + * @returns {object} metadata of MetricTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricTrigger', + type: { + name: 'Composite', + className: 'MetricTrigger', + modelProperties: { + metricName: { + required: true, + serializedName: 'metricName', + type: { + name: 'String' + } + }, + metricResourceUri: { + required: true, + serializedName: 'metricResourceUri', + type: { + name: 'String' + } + }, + timeGrain: { + required: true, + serializedName: 'timeGrain', + type: { + name: 'TimeSpan' + } + }, + statistic: { + required: true, + serializedName: 'statistic', + type: { + name: 'Enum', + allowedValues: [ 'Average', 'Min', 'Max', 'Sum' ] + } + }, + timeWindow: { + required: true, + serializedName: 'timeWindow', + type: { + name: 'TimeSpan' + } + }, + timeAggregation: { + required: true, + serializedName: 'timeAggregation', + type: { + name: 'Enum', + allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Count' ] + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'Enum', + allowedValues: [ 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = MetricTrigger; diff --git a/lib/services/monitor/lib/lib/models/metricValue.js b/lib/services/monitor/lib/lib/models/metricValue.js new file mode 100644 index 0000000000..289f6ad9b0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/metricValue.js @@ -0,0 +1,95 @@ +/* + * 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 metric value. + * + */ +class MetricValue { + /** + * Create a MetricValue. + * @member {date} timeStamp the timestamp for the metric value in ISO 8601 + * format. + * @member {number} [average] the average value in the time range. + * @member {number} [minimum] the least value in the time range. + * @member {number} [maximum] the greatest value in the time range. + * @member {number} [total] the sum of all of the values in the time range. + * @member {number} [count] the number of samples in the time range. Can be + * used to determine the number of values that contributed to the average + * value. + */ + constructor() { + } + + /** + * Defines the metadata of MetricValue + * + * @returns {object} metadata of MetricValue + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricValue', + type: { + name: 'Composite', + className: 'MetricValue', + modelProperties: { + timeStamp: { + required: true, + serializedName: 'timeStamp', + type: { + name: 'DateTime' + } + }, + average: { + required: false, + serializedName: 'average', + type: { + name: 'Number' + } + }, + minimum: { + required: false, + serializedName: 'minimum', + type: { + name: 'Number' + } + }, + maximum: { + required: false, + serializedName: 'maximum', + type: { + name: 'Number' + } + }, + total: { + required: false, + serializedName: 'total', + type: { + name: 'Number' + } + }, + count: { + required: false, + serializedName: 'count', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = MetricValue; diff --git a/lib/services/monitor/lib/lib/models/operation.js b/lib/services/monitor/lib/lib/models/operation.js new file mode 100644 index 0000000000..83a27ddcc0 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/operation.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Microsoft Insights API operation definition. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft.Insights + * @member {string} [display.resource] Resource on which the operation is + * performed: AlertRules, Autoscale, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/monitor/lib/lib/models/operationDisplay.js b/lib/services/monitor/lib/lib/models/operationDisplay.js new file mode 100644 index 0000000000..8e414a0a13 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/operationDisplay.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'; + +/** + * Display metadata associated with the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft.Insights + * @member {string} [resource] Resource on which the operation is performed: + * AlertRules, Autoscale, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/monitor/lib/lib/models/operationListResult.js b/lib/services/monitor/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..cad3161962 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/operationListResult.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Result of the request to list Microsoft.Insights operations. It contains a + * list of operations and a URL link to get the next set of results. + * + */ +class OperationListResult { + /** + * Create a OperationListResult. + * @member {array} [value] List of operations supported by the + * Microsoft.Insights provider. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/monitor/lib/lib/models/proxyOnlyResource.js b/lib/services/monitor/lib/lib/models/proxyOnlyResource.js new file mode 100644 index 0000000000..768abba9af --- /dev/null +++ b/lib/services/monitor/lib/lib/models/proxyOnlyResource.js @@ -0,0 +1,75 @@ +/* + * 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'); + +/** + * A proxy only azure resource object + * + * @extends models['BaseResource'] + */ +class ProxyOnlyResource extends models['BaseResource'] { + /** + * Create a ProxyOnlyResource. + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProxyOnlyResource + * + * @returns {object} metadata of ProxyOnlyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ProxyOnlyResource', + type: { + name: 'Composite', + className: 'ProxyOnlyResource', + 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' + } + } + } + } + }; + } +} + +module.exports = ProxyOnlyResource; diff --git a/lib/services/monitor/lib/lib/models/recurrence.js b/lib/services/monitor/lib/lib/models/recurrence.js new file mode 100644 index 0000000000..cb2dddd1d5 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/recurrence.js @@ -0,0 +1,114 @@ +/* + * 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 repeating times at which this profile begins. This element is not used + * if the FixedDate element is used. + * + */ +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 + * profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard + * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada + * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + * Atlantic Standard Time, Central Brazilian Standard Time, SA Western + * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + * South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} [schedule.days] the collection of days that the profile + * takes effect on. Possible values are Sunday through Saturday. + * @member {array} [schedule.hours] A collection of hours that the profile + * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM + * times are not supported). + * @member {array} [schedule.minutes] A collection of minutes at which the + * profile takes effect at. + */ + constructor() { + } + + /** + * Defines the metadata of Recurrence + * + * @returns {object} metadata of Recurrence + * + */ + mapper() { + return { + required: false, + serializedName: 'Recurrence', + type: { + name: 'Composite', + className: 'Recurrence', + modelProperties: { + frequency: { + required: true, + serializedName: 'frequency', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ] + } + }, + schedule: { + required: true, + serializedName: 'schedule', + type: { + name: 'Composite', + className: 'RecurrentSchedule' + } + } + } + } + }; + } +} + +module.exports = Recurrence; diff --git a/lib/services/monitor/lib/lib/models/recurrentSchedule.js b/lib/services/monitor/lib/lib/models/recurrentSchedule.js new file mode 100644 index 0000000000..dec886f658 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/recurrentSchedule.js @@ -0,0 +1,138 @@ +/* + * 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 scheduling constraints for when the profile begins. + * + */ +class RecurrentSchedule { + /** + * Create a RecurrentSchedule. + * @member {string} timeZone the timezone for the hours of the profile. Some + * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian + * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), + * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time + * (Mexico), Mountain Standard Time, Central America Standard Time, Central + * Standard Time, Central Standard Time (Mexico), Canada Central Standard + * Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard + * Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard + * Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific + * SA Standard Time, Newfoundland Standard Time, E. South America Standard + * Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard + * Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard + * Time, W. Europe Standard Time, Central Europe Standard Time, Romance + * Standard Time, Central European Standard Time, W. Central Africa Standard + * Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, + * Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. + * Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {array} days the collection of days that the profile takes effect + * on. Possible values are Sunday through Saturday. + * @member {array} hours A collection of hours that the profile takes effect + * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not + * supported). + * @member {array} minutes A collection of minutes at which the profile takes + * effect at. + */ + constructor() { + } + + /** + * Defines the metadata of RecurrentSchedule + * + * @returns {object} metadata of RecurrentSchedule + * + */ + mapper() { + return { + required: false, + serializedName: 'RecurrentSchedule', + type: { + name: 'Composite', + className: 'RecurrentSchedule', + modelProperties: { + timeZone: { + required: true, + serializedName: 'timeZone', + type: { + name: 'String' + } + }, + days: { + required: true, + serializedName: 'days', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + hours: { + required: true, + serializedName: 'hours', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + minutes: { + required: true, + serializedName: 'minutes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = RecurrentSchedule; diff --git a/lib/services/monitor/lib/lib/models/resource.js b/lib/services/monitor/lib/lib/models/resource.js new file mode 100644 index 0000000000..429ae3a958 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/resource.js @@ -0,0 +1,98 @@ +/* + * 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'); + +/** + * An azure resource object + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Azure resource Id + * @member {string} [name] Azure resource name + * @member {string} [type] Azure resource type + * @member {string} location Resource location + * @member {object} [tags] Resource tags + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + 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' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/monitor/lib/lib/models/response.js b/lib/services/monitor/lib/lib/models/response.js new file mode 100644 index 0000000000..20e0c9cbb3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/response.js @@ -0,0 +1,113 @@ +/* + * 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 response to a metrics query. + * + */ +class Response { + /** + * Create a Response. + * @member {number} [cost] The integer value representing the cost of the + * query, for data case. + * @member {string} timespan The timespan for which the data was retrieved. + * Its value consists of two datatimes concatenated, separated by '/'. This + * may be adjusted in the future and returned back from what was originally + * requested. + * @member {moment.duration} [interval] The interval (window size) for which + * the metric data was returned in. This may be adjusted in the future and + * returned back from what was originally requested. This is not present if + * a metadata request was made. + * @member {string} [namespace] The namespace of the metrics been queried + * @member {string} [resourceregion] The region of the resource been queried + * for metrics. + * @member {array} value the value of the collection. + */ + constructor() { + } + + /** + * Defines the metadata of Response + * + * @returns {object} metadata of Response + * + */ + mapper() { + return { + required: false, + serializedName: 'Response', + type: { + name: 'Composite', + className: 'Response', + modelProperties: { + cost: { + required: false, + serializedName: 'cost', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + }, + timespan: { + required: true, + serializedName: 'timespan', + type: { + name: 'String' + } + }, + interval: { + required: false, + serializedName: 'interval', + type: { + name: 'TimeSpan' + } + }, + namespace: { + required: false, + serializedName: 'namespace', + type: { + name: 'String' + } + }, + resourceregion: { + required: false, + serializedName: 'resourceregion', + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricElementType', + type: { + name: 'Composite', + className: 'Metric' + } + } + } + } + } + } + }; + } +} + +module.exports = Response; diff --git a/lib/services/monitor/lib/lib/models/retentionPolicy.js b/lib/services/monitor/lib/lib/models/retentionPolicy.js new file mode 100644 index 0000000000..1ae39bed86 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/retentionPolicy.js @@ -0,0 +1,65 @@ +/* + * 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 retention policy for the log. + * + */ +class RetentionPolicy { + /** + * Create a RetentionPolicy. + * @member {boolean} enabled a value indicating whether the retention policy + * is enabled. + * @member {number} days the number of days for the retention in days. A + * value of 0 will retain the events indefinitely. + */ + constructor() { + } + + /** + * Defines the metadata of RetentionPolicy + * + * @returns {object} metadata of RetentionPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'RetentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicy', + modelProperties: { + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + days: { + required: true, + serializedName: 'days', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = RetentionPolicy; diff --git a/lib/services/monitor/lib/lib/models/ruleAction.js b/lib/services/monitor/lib/lib/models/ruleAction.js new file mode 100644 index 0000000000..8cc7f75b03 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleAction.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'; + +/** + * The action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + */ +class RuleAction { + /** + * Create a RuleAction. + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of RuleAction + * + * @returns {object} metadata of RuleAction + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleAction; diff --git a/lib/services/monitor/lib/lib/models/ruleCondition.js b/lib/services/monitor/lib/lib/models/ruleCondition.js new file mode 100644 index 0000000000..5b43f85397 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleCondition.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'; + +const models = require('./index'); + +/** + * The condition that results in the alert rule being activated. + * + */ +class RuleCondition { + /** + * Create a RuleCondition. + * @member {object} [dataSource] the resource from which the rule collects + * its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * @member {string} [dataSource.resourceUri] the resource identifier of the + * resource the rule monitors. **NOTE**: this property cannot be updated for + * an existing rule. + * @member {string} [dataSource.odatatype] Polymorphic Discriminator + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of RuleCondition + * + * @returns {object} metadata of RuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'RuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleCondition; diff --git a/lib/services/monitor/lib/lib/models/ruleDataSource.js b/lib/services/monitor/lib/lib/models/ruleDataSource.js new file mode 100644 index 0000000000..f106206ee3 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleDataSource.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The resource from which the rule collects its data. + * + */ +class RuleDataSource { + /** + * Create a RuleDataSource. + * @member {string} [resourceUri] the resource identifier of the resource the + * rule monitors. **NOTE**: this property cannot be updated for an existing + * rule. + * @member {string} odatatype Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of RuleDataSource + * + * @returns {object} metadata of RuleDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleDataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource', + modelProperties: { + resourceUri: { + required: false, + serializedName: 'resourceUri', + type: { + name: 'String' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleEmailAction.js b/lib/services/monitor/lib/lib/models/ruleEmailAction.js new file mode 100644 index 0000000000..7a5a3b4e66 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleEmailAction.js @@ -0,0 +1,88 @@ +/* + * 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'); + +/** + * Specifies the action to send email when the rule condition is evaluated. The + * discriminator is always RuleEmailAction in this case. + * + * @extends models['RuleAction'] + */ +class RuleEmailAction extends models['RuleAction'] { + /** + * Create a RuleEmailAction. + * @member {boolean} [sendToServiceOwners] Whether the administrators + * (service and co-administrators) of the service should be notified when the + * alert is activated. + * @member {array} [customEmails] the list of administrator's custom email + * addresses to notify of the activation of the alert. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleEmailAction + * + * @returns {object} metadata of RuleEmailAction + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleEmailAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + sendToServiceOwners: { + required: false, + serializedName: 'sendToServiceOwners', + type: { + name: 'Boolean' + } + }, + customEmails: { + required: false, + serializedName: 'customEmails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = RuleEmailAction; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js new file mode 100644 index 0000000000..a8a5de752c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js @@ -0,0 +1,52 @@ +/* + * 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 claims for a rule management event data source. + * + */ +class RuleManagementEventClaimsDataSource { + /** + * Create a RuleManagementEventClaimsDataSource. + * @member {string} [emailAddress] the email address. + */ + constructor() { + } + + /** + * Defines the metadata of RuleManagementEventClaimsDataSource + * + * @returns {object} metadata of RuleManagementEventClaimsDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'RuleManagementEventClaimsDataSource', + type: { + name: 'Composite', + className: 'RuleManagementEventClaimsDataSource', + modelProperties: { + emailAddress: { + required: false, + serializedName: 'emailAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleManagementEventClaimsDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js new file mode 100644 index 0000000000..b981085f6d --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js @@ -0,0 +1,145 @@ +/* + * 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'); + +/** + * A rule management event data source. The discriminator fields is always + * RuleManagementEventDataSource in this case. + * + * @extends models['RuleDataSource'] + */ +class RuleManagementEventDataSource extends models['RuleDataSource'] { + /** + * Create a RuleManagementEventDataSource. + * @member {string} [eventName] the event name. + * @member {string} [eventSource] the event source. + * @member {string} [level] the level. + * @member {string} [operationName] The name of the operation that should be + * checked for. If no name is provided, any operation will match. + * @member {string} [resourceGroupName] the resource group name. + * @member {string} [resourceProviderName] the resource provider name. + * @member {string} [status] The status of the operation that should be + * checked for. If no status is provided, any status will match. + * @member {string} [subStatus] the substatus. + * @member {object} [claims] the claims. + * @member {string} [claims.emailAddress] the email address. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleManagementEventDataSource + * + * @returns {object} metadata of RuleManagementEventDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleManagementEventDataSource', + modelProperties: { + resourceUri: { + required: false, + serializedName: 'resourceUri', + type: { + name: 'String' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + eventName: { + required: false, + serializedName: 'eventName', + type: { + name: 'String' + } + }, + eventSource: { + required: false, + serializedName: 'eventSource', + type: { + name: 'String' + } + }, + level: { + required: false, + serializedName: 'level', + type: { + name: 'String' + } + }, + operationName: { + required: false, + serializedName: 'operationName', + type: { + name: 'String' + } + }, + resourceGroupName: { + required: false, + serializedName: 'resourceGroupName', + type: { + name: 'String' + } + }, + resourceProviderName: { + required: false, + serializedName: 'resourceProviderName', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + subStatus: { + required: false, + serializedName: 'subStatus', + type: { + name: 'String' + } + }, + claims: { + required: false, + serializedName: 'claims', + type: { + name: 'Composite', + className: 'RuleManagementEventClaimsDataSource' + } + } + } + } + }; + } +} + +module.exports = RuleManagementEventDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js b/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js new file mode 100644 index 0000000000..abf2f6aae1 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js @@ -0,0 +1,78 @@ +/* + * 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'); + +/** + * A rule metric data source. The discriminator value is always + * RuleMetricDataSource in this case. + * + * @extends models['RuleDataSource'] + */ +class RuleMetricDataSource extends models['RuleDataSource'] { + /** + * Create a RuleMetricDataSource. + * @member {string} [metricName] the name of the metric that defines what the + * rule monitors. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleMetricDataSource + * + * @returns {object} metadata of RuleMetricDataSource + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleMetricDataSource', + modelProperties: { + resourceUri: { + required: false, + serializedName: 'resourceUri', + type: { + name: 'String' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + metricName: { + required: false, + serializedName: 'metricName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RuleMetricDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleWebhookAction.js b/lib/services/monitor/lib/lib/models/ruleWebhookAction.js new file mode 100644 index 0000000000..58cf335564 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/ruleWebhookAction.js @@ -0,0 +1,88 @@ +/* + * 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'); + +/** + * Specifies the action to post to service when the rule condition is + * evaluated. The discriminator is always RuleWebhookAction in this case. + * + * @extends models['RuleAction'] + */ +class RuleWebhookAction extends models['RuleAction'] { + /** + * Create a RuleWebhookAction. + * @member {string} [serviceUri] the service uri to Post the notification + * when the alert activates or resolves. + * @member {object} [properties] the dictionary of custom properties to + * include with the post operation. These data are appended to the webhook + * payload. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RuleWebhookAction + * + * @returns {object} metadata of RuleWebhookAction + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleAction', + className: 'RuleWebhookAction', + modelProperties: { + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + serviceUri: { + required: false, + serializedName: 'serviceUri', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = RuleWebhookAction; diff --git a/lib/services/monitor/lib/lib/models/scaleAction.js b/lib/services/monitor/lib/lib/models/scaleAction.js new file mode 100644 index 0000000000..e07a8a5d27 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/scaleAction.js @@ -0,0 +1,87 @@ +/* + * 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 parameters for the scaling action. + * + */ +class ScaleAction { + /** + * Create a ScaleAction. + * @member {string} direction the scale direction. Whether the scaling action + * increases or decreases the number of instances. Possible values include: + * 'None', 'Increase', 'Decrease' + * @member {string} type the type of action that should occur when the scale + * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', + * 'ExactCount' + * @member {string} [value] the number of instances that are involved in the + * scaling action. This value must be 1 or greater. The default value is 1. + * Default value: '1' . + * @member {moment.duration} cooldown the amount of time to wait since the + * last scaling action before this action occurs. It must be between 1 week + * and 1 minute in ISO 8601 format. + */ + constructor() { + } + + /** + * Defines the metadata of ScaleAction + * + * @returns {object} metadata of ScaleAction + * + */ + mapper() { + return { + required: false, + serializedName: 'ScaleAction', + type: { + name: 'Composite', + className: 'ScaleAction', + modelProperties: { + direction: { + required: true, + serializedName: 'direction', + type: { + name: 'Enum', + allowedValues: [ 'None', 'Increase', 'Decrease' ] + } + }, + type: { + required: true, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'ChangeCount', 'PercentChangeCount', 'ExactCount' ] + } + }, + value: { + required: false, + serializedName: 'value', + defaultValue: '1', + type: { + name: 'String' + } + }, + cooldown: { + required: true, + serializedName: 'cooldown', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = ScaleAction; diff --git a/lib/services/monitor/lib/lib/models/scaleCapacity.js b/lib/services/monitor/lib/lib/models/scaleCapacity.js new file mode 100644 index 0000000000..841ec3393c --- /dev/null +++ b/lib/services/monitor/lib/lib/models/scaleCapacity.js @@ -0,0 +1,72 @@ +/* + * 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 number of instances that can be used during this profile. + * + */ +class ScaleCapacity { + /** + * Create a ScaleCapacity. + * @member {string} minimum the minimum number of instances for the resource. + * @member {string} maximum the maximum number of instances for the resource. + * The actual maximum number of instances is limited by the cores that are + * available in the subscription. + * @member {string} default the number of instances that will be set if + * metrics are not available for evaluation. The default is only used if the + * current instance count is lower than the default. + */ + constructor() { + } + + /** + * Defines the metadata of ScaleCapacity + * + * @returns {object} metadata of ScaleCapacity + * + */ + mapper() { + return { + required: false, + serializedName: 'ScaleCapacity', + type: { + name: 'Composite', + className: 'ScaleCapacity', + modelProperties: { + minimum: { + required: true, + serializedName: 'minimum', + type: { + name: 'String' + } + }, + maximum: { + required: true, + serializedName: 'maximum', + type: { + name: 'String' + } + }, + default: { + required: true, + serializedName: 'default', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ScaleCapacity; diff --git a/lib/services/monitor/lib/lib/models/scaleRule.js b/lib/services/monitor/lib/lib/models/scaleRule.js new file mode 100644 index 0000000000..0836d498c2 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/scaleRule.js @@ -0,0 +1,102 @@ +/* + * 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'); + +/** + * A rule that provide the triggers and parameters for the scaling action. + * + */ +class ScaleRule { + /** + * Create a ScaleRule. + * @member {object} metricTrigger the trigger that results in a scaling + * action. + * @member {string} [metricTrigger.metricName] the name of the metric that + * defines what the rule monitors. + * @member {string} [metricTrigger.metricResourceUri] the resource identifier + * of the resource the rule monitors. + * @member {moment.duration} [metricTrigger.timeGrain] the granularity of + * metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [metricTrigger.statistic] the metric statistic type. How + * the metrics from multiple instances are combined. Possible values include: + * 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [metricTrigger.timeWindow] the range of time in + * which instance data is collected. This value must be greater than the + * delay in metric collection, which can vary from resource-to-resource. Must + * be between 12 hours and 5 minutes. + * @member {string} [metricTrigger.timeAggregation] time aggregation type. + * How the data that is collected should be combined over time. The default + * value is Average. Possible values include: 'Average', 'Minimum', + * 'Maximum', 'Total', 'Count' + * @member {string} [metricTrigger.operator] the operator that is used to + * compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [metricTrigger.threshold] the threshold of the metric + * that triggers the scale action. + * @member {object} scaleAction the parameters for the scaling action. + * @member {string} [scaleAction.direction] the scale direction. Whether the + * scaling action increases or decreases the number of instances. Possible + * values include: 'None', 'Increase', 'Decrease' + * @member {string} [scaleAction.type] the type of action that should occur + * when the scale rule fires. Possible values include: 'ChangeCount', + * 'PercentChangeCount', 'ExactCount' + * @member {string} [scaleAction.value] the number of instances that are + * involved in the scaling action. This value must be 1 or greater. The + * default value is 1. + * @member {moment.duration} [scaleAction.cooldown] the amount of time to + * wait since the last scaling action before this action occurs. It must be + * between 1 week and 1 minute in ISO 8601 format. + */ + constructor() { + } + + /** + * Defines the metadata of ScaleRule + * + * @returns {object} metadata of ScaleRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ScaleRule', + type: { + name: 'Composite', + className: 'ScaleRule', + modelProperties: { + metricTrigger: { + required: true, + serializedName: 'metricTrigger', + type: { + name: 'Composite', + className: 'MetricTrigger' + } + }, + scaleAction: { + required: true, + serializedName: 'scaleAction', + type: { + name: 'Composite', + className: 'ScaleAction' + } + } + } + } + }; + } +} + +module.exports = ScaleRule; diff --git a/lib/services/monitor/lib/lib/models/senderAuthorization.js b/lib/services/monitor/lib/lib/models/senderAuthorization.js new file mode 100644 index 0000000000..db357336e2 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/senderAuthorization.js @@ -0,0 +1,72 @@ +/* + * 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 authorization used by the user who has performed the operation that led + * to this event. This captures the RBAC properties of the event. These usually + * include the 'action', 'role' and the 'scope' + * + */ +class SenderAuthorization { + /** + * Create a SenderAuthorization. + * @member {string} [action] the permissible actions. For instance: + * microsoft.support/supporttickets/write + * @member {string} [role] the role of the user. For instance: Subscription + * Admin + * @member {string} [scope] the scope. + */ + constructor() { + } + + /** + * Defines the metadata of SenderAuthorization + * + * @returns {object} metadata of SenderAuthorization + * + */ + mapper() { + return { + required: false, + serializedName: 'SenderAuthorization', + type: { + name: 'Composite', + className: 'SenderAuthorization', + modelProperties: { + action: { + required: false, + serializedName: 'action', + type: { + name: 'String' + } + }, + role: { + required: false, + serializedName: 'role', + type: { + name: 'String' + } + }, + scope: { + required: false, + serializedName: 'scope', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SenderAuthorization; diff --git a/lib/services/monitor/lib/lib/models/smsReceiver.js b/lib/services/monitor/lib/lib/models/smsReceiver.js new file mode 100644 index 0000000000..9579690c9e --- /dev/null +++ b/lib/services/monitor/lib/lib/models/smsReceiver.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'; + +/** + * An SMS receiver. + * + */ +class SmsReceiver { + /** + * Create a SmsReceiver. + * @member {string} name The name of the SMS receiver. Names must be unique + * across all receivers within an action group. + * @member {string} countryCode The country code of the SMS receiver. + * @member {string} phoneNumber The phone number of the SMS receiver. + * @member {string} [status] The status of the receiver. Possible values + * include: 'NotSpecified', 'Enabled', 'Disabled' + */ + constructor() { + } + + /** + * Defines the metadata of SmsReceiver + * + * @returns {object} metadata of SmsReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'SmsReceiver', + type: { + name: 'Composite', + className: 'SmsReceiver', + 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' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] + } + } + } + } + }; + } +} + +module.exports = SmsReceiver; diff --git a/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js new file mode 100644 index 0000000000..899822bb45 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js @@ -0,0 +1,115 @@ +/* + * 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'); + +/** + * A rule condition based on a metric crossing a threshold. + * + * @extends models['RuleCondition'] + */ +class ThresholdRuleCondition extends models['RuleCondition'] { + /** + * Create a ThresholdRuleCondition. + * @member {string} operator the operator used to compare the data and the + * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', + * 'LessThan', 'LessThanOrEqual' + * @member {number} threshold the threshold value that activates the alert. + * @member {moment.duration} [windowSize] the period of time (in ISO 8601 + * duration format) that is used to monitor alert activity based on the + * threshold. If specified then it must be between 5 minutes and 1 day. + * @member {string} [timeAggregation] the time aggregation operator. How the + * data that are collected should be combined over time. The default value is + * the PrimaryAggregationType of the Metric. Possible values include: + * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ThresholdRuleCondition + * + * @returns {object} metadata of ThresholdRuleCondition + * + */ + mapper() { + return { + required: false, + serializedName: 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleCondition', + className: 'ThresholdRuleCondition', + modelProperties: { + dataSource: { + required: false, + serializedName: 'dataSource', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'RuleDataSource', + className: 'RuleDataSource' + } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + operator: { + required: true, + serializedName: 'operator', + type: { + name: 'Enum', + allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] + } + }, + threshold: { + required: true, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + windowSize: { + required: false, + serializedName: 'windowSize', + type: { + name: 'TimeSpan' + } + }, + timeAggregation: { + required: false, + serializedName: 'timeAggregation', + type: { + name: 'Enum', + allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Last' ] + } + } + } + } + }; + } +} + +module.exports = ThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesElement.js b/lib/services/monitor/lib/lib/models/timeSeriesElement.js new file mode 100644 index 0000000000..576f5a51ab --- /dev/null +++ b/lib/services/monitor/lib/lib/models/timeSeriesElement.js @@ -0,0 +1,81 @@ +/* + * 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'); + +/** + * A time series result type. The discriminator value is always TimeSeries in + * this case. + * + */ +class TimeSeriesElement { + /** + * Create a TimeSeriesElement. + * @member {array} [metadatavalues] the metadata values returned if $filter + * was specified in the call. + * @member {array} [data] An array of data points representing the metric + * values. This is only returned if a result type of data is specified. + */ + constructor() { + } + + /** + * Defines the metadata of TimeSeriesElement + * + * @returns {object} metadata of TimeSeriesElement + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeSeriesElement', + type: { + name: 'Composite', + className: 'TimeSeriesElement', + modelProperties: { + metadatavalues: { + required: false, + serializedName: 'metadatavalues', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetadataValueElementType', + type: { + name: 'Composite', + className: 'MetadataValue' + } + } + } + }, + data: { + required: false, + serializedName: 'data', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricValueElementType', + type: { + name: 'Composite', + className: 'MetricValue' + } + } + } + } + } + } + }; + } +} + +module.exports = TimeSeriesElement; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesInformation.js b/lib/services/monitor/lib/lib/models/timeSeriesInformation.js new file mode 100644 index 0000000000..f4d8ac5464 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/timeSeriesInformation.js @@ -0,0 +1,90 @@ +/* + * 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 time series info needed for calculating the baseline. + * + */ +class TimeSeriesInformation { + /** + * Create a TimeSeriesInformation. + * @member {array} sensitivities the list of sensitivities for calculating + * the baseline. + * @member {array} values The metric values to calculate the baseline. + * @member {array} [timestamps] the array of timestamps of the baselines. + */ + constructor() { + } + + /** + * Defines the metadata of TimeSeriesInformation + * + * @returns {object} metadata of TimeSeriesInformation + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeSeriesInformation', + type: { + name: 'Composite', + className: 'TimeSeriesInformation', + modelProperties: { + sensitivities: { + required: true, + serializedName: 'sensitivities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + values: { + required: true, + serializedName: 'values', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + timestamps: { + required: false, + serializedName: 'timestamps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DateElementType', + type: { + name: 'DateTime' + } + } + } + } + } + } + }; + } +} + +module.exports = TimeSeriesInformation; diff --git a/lib/services/monitor/lib/lib/models/timeWindow.js b/lib/services/monitor/lib/lib/models/timeWindow.js new file mode 100644 index 0000000000..c072fd288a --- /dev/null +++ b/lib/services/monitor/lib/lib/models/timeWindow.js @@ -0,0 +1,105 @@ +/* + * 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 specific date-time for the profile. + * + */ +class TimeWindow { + /** + * Create a TimeWindow. + * @member {string} [timeZone] the timezone of the start and end times for + * the profile. Some examples of valid timezones are: Dateline Standard Time, + * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard + * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain + * Standard Time (Mexico), Mountain Standard Time, Central America Standard + * Time, Central Standard Time, Central Standard Time (Mexico), Canada + * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US + * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, + * Atlantic Standard Time, Central Brazilian Standard Time, SA Western + * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. + * South America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde + * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich + * Standard Time, W. Europe Standard Time, Central Europe Standard Time, + * Romance Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, + * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, + * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, + * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus + * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran + * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia + * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus + * Standard Time, Afghanistan Standard Time, West Asia Standard Time, + * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, + * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, + * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard + * Time, SE Asia Standard Time, North Asia Standard Time, China Standard + * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia + * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo + * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia + * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS + * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard + * Time, Samoa Standard Time, Line Islands Standard Time + * @member {date} start the start time for the profile in ISO 8601 format. + * @member {date} end the end time for the profile in ISO 8601 format. + */ + constructor() { + } + + /** + * Defines the metadata of TimeWindow + * + * @returns {object} metadata of TimeWindow + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeWindow', + type: { + name: 'Composite', + className: 'TimeWindow', + modelProperties: { + timeZone: { + required: false, + serializedName: 'timeZone', + type: { + name: 'String' + } + }, + start: { + required: true, + serializedName: 'start', + type: { + name: 'DateTime' + } + }, + end: { + required: true, + serializedName: 'end', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = TimeWindow; diff --git a/lib/services/monitor/lib/lib/models/voiceReceiver.js b/lib/services/monitor/lib/lib/models/voiceReceiver.js new file mode 100644 index 0000000000..ac1ac1025d --- /dev/null +++ b/lib/services/monitor/lib/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/monitor/lib/lib/models/webhookNotification.js b/lib/services/monitor/lib/lib/models/webhookNotification.js new file mode 100644 index 0000000000..bc05f4b1a1 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/webhookNotification.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'; + +/** + * Webhook notification of an autoscale event. + * + */ +class WebhookNotification { + /** + * Create a WebhookNotification. + * @member {string} [serviceUri] the service address to receive the + * notification. + * @member {object} [properties] a property bag of settings. This value can + * be empty. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookNotification + * + * @returns {object} metadata of WebhookNotification + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookNotification', + type: { + name: 'Composite', + className: 'WebhookNotification', + modelProperties: { + serviceUri: { + required: false, + serializedName: 'serviceUri', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = WebhookNotification; diff --git a/lib/services/monitor/lib/lib/models/webhookReceiver.js b/lib/services/monitor/lib/lib/models/webhookReceiver.js new file mode 100644 index 0000000000..bfaf7cd202 --- /dev/null +++ b/lib/services/monitor/lib/lib/models/webhookReceiver.js @@ -0,0 +1,61 @@ +/* + * 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 webhook receiver. + * + */ +class WebhookReceiver { + /** + * Create a WebhookReceiver. + * @member {string} name The name of the webhook receiver. Names must be + * unique across all receivers within an action group. + * @member {string} serviceUri The URI where webhooks should be sent. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookReceiver + * + * @returns {object} metadata of WebhookReceiver + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookReceiver', + type: { + name: 'Composite', + className: 'WebhookReceiver', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + serviceUri: { + required: true, + serializedName: 'serviceUri', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebhookReceiver; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.d.ts b/lib/services/monitor/lib/lib/monitorManagementClient.d.ts new file mode 100644 index 0000000000..9c64e133dc --- /dev/null +++ b/lib/services/monitor/lib/lib/monitorManagementClient.d.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class MonitorManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the MonitorManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The Azure subscription Id. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @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. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + autoscaleSettings: operations.AutoscaleSettings; + operations: operations.Operations; + alertRuleIncidents: operations.AlertRuleIncidents; + alertRules: operations.AlertRules; + logProfiles: operations.LogProfiles; + diagnosticSettingsOperations: operations.DiagnosticSettingsOperations; + diagnosticSettingsCategoryOperations: operations.DiagnosticSettingsCategoryOperations; + actionGroups: operations.ActionGroups; + activityLogAlerts: operations.ActivityLogAlerts; + activityLogs: operations.ActivityLogs; + eventCategories: operations.EventCategories; + tenantActivityLogs: operations.TenantActivityLogs; + metricDefinitions: operations.MetricDefinitions; + metrics: operations.Metrics; + metricBaseline: operations.MetricBaseline; + metricAlerts: operations.MetricAlerts; + metricAlertsStatus: operations.MetricAlertsStatus; +} + +export { MonitorManagementClient, models as MonitorManagementModels }; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.js b/lib/services/monitor/lib/lib/monitorManagementClient.js new file mode 100644 index 0000000000..356cd3c461 --- /dev/null +++ b/lib/services/monitor/lib/lib/monitorManagementClient.js @@ -0,0 +1,100 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a MonitorManagementClient. */ +class MonitorManagementClient extends ServiceClient { + /** + * Create a MonitorManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The Azure subscription Id. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @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. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.autoscaleSettings = new operations.AutoscaleSettings(this); + this.operations = new operations.Operations(this); + this.alertRuleIncidents = new operations.AlertRuleIncidents(this); + this.alertRules = new operations.AlertRules(this); + this.logProfiles = new operations.LogProfiles(this); + this.diagnosticSettingsOperations = new operations.DiagnosticSettingsOperations(this); + this.diagnosticSettingsCategoryOperations = new operations.DiagnosticSettingsCategoryOperations(this); + this.actionGroups = new operations.ActionGroups(this); + this.activityLogAlerts = new operations.ActivityLogAlerts(this); + this.activityLogs = new operations.ActivityLogs(this); + this.eventCategories = new operations.EventCategories(this); + this.tenantActivityLogs = new operations.TenantActivityLogs(this); + this.metricDefinitions = new operations.MetricDefinitions(this); + this.metrics = new operations.Metrics(this); + this.metricBaseline = new operations.MetricBaseline(this); + this.metricAlerts = new operations.MetricAlerts(this); + this.metricAlertsStatus = new operations.MetricAlertsStatus(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = MonitorManagementClient; +module.exports['default'] = MonitorManagementClient; +module.exports.MonitorManagementClient = MonitorManagementClient; +module.exports.MonitorManagementModels = models; diff --git a/lib/services/monitor/lib/lib/operations/actionGroups.js b/lib/services/monitor/lib/lib/operations/actionGroups.js new file mode 100644 index 0000000000..5c41c3e997 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/actionGroups.js @@ -0,0 +1,1810 @@ +/* + * 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; + +/** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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 ActionGroupResource} 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, actionGroupName, actionGroup, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); + } + if (actionGroup === null || actionGroup === undefined) { + throw new Error('actionGroup cannot be null or undefined.'); + } + 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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 = '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 (actionGroup !== null && actionGroup !== undefined) { + let requestModelMapper = new client.models['ActionGroupResource']().mapper(); + requestModel = client.serialize(requestModelMapper, actionGroup, 'actionGroup'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(actionGroup, 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['ActionGroupResource']().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['ActionGroupResource']().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); + }); +} + +/** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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 ActionGroupResource} 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, actionGroupName, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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['ActionGroupResource']().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); + }); +} + +/** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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); + }); +} + +/** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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-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 (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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); + } + if (actionGroupPatch === null || actionGroupPatch === undefined) { + throw new Error('actionGroupPatch 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/actionGroups/{actionGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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 (actionGroupPatch !== null && actionGroupPatch !== undefined) { + let requestModelMapper = new client.models['ActionGroupPatchBody']().mapper(); + requestModel = client.serialize(requestModelMapper, actionGroupPatch, 'actionGroupPatch'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(actionGroupPatch, 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['ActionGroupResource']().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); + }); +} + +/** + * Get a list of all action groups in 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 ActionGroupList} 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 _listBySubscriptionId(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-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/actionGroups'; + 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['ActionGroupList']().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); + }); +} + +/** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 ActionGroupList} 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 apiVersion = '2018-03-01'; + // 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 (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/actionGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ActionGroupList']().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); + }); +} + +/** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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 _enableReceiver(resourceGroupName, actionGroupName, receiverName, 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-03-01'; + // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { + throw new Error('actionGroupName 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 (receiverName === null || receiverName === undefined || typeof receiverName.valueOf() !== 'string') { + throw new Error('receiverName 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); + } + let enableRequest; + if (receiverName !== null && receiverName !== undefined) { + enableRequest = new client.models['EnableRequest'](); + enableRequest.receiverName = receiverName; + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); + 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 = 'POST'; + 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 (enableRequest !== null && enableRequest !== undefined) { + let requestModelMapper = new client.models['EnableRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, enableRequest, 'enableRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(enableRequest, 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 !== 409) { + 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); + }); +} + +/** Class representing a ActionGroups. */ +class ActionGroups { + /** + * Create a ActionGroups. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listBySubscriptionId = _listBySubscriptionId; + this._listByResourceGroup = _listByResourceGroup; + this._enableReceiver = _enableReceiver; + } + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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, actionGroupName, actionGroup, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroup, 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, actionGroupName, actionGroup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, optionalCallback); + } + } + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, actionGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, actionGroupName, options, optionalCallback); + } + } + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, actionGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, actionGroupName, options, optionalCallback); + } + } + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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, actionGroupName, actionGroupPatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, optionalCallback); + } + } + + /** + * Get a list of all action groups in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionId(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a list of all action groups in 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 {ActionGroupList} - 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 ActionGroupList} 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. + */ + listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionId(options, optionalCallback); + } + } + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActionGroupList} - 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 ActionGroupList} 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); + } + } + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiverWithHttpOperationResponse(resourceGroupName, actionGroupName, receiverName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiver(resourceGroupName, actionGroupName, receiverName, 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._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, optionalCallback); + } + } + +} + +module.exports = ActionGroups; diff --git a/lib/services/monitor/lib/lib/operations/activityLogAlerts.js b/lib/services/monitor/lib/lib/operations/activityLogAlerts.js new file mode 100644 index 0000000000..bc6417b698 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/activityLogAlerts.js @@ -0,0 +1,1543 @@ +/* + * 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; + +/** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); + } + if (activityLogAlert === null || activityLogAlert === undefined) { + throw new Error('activityLogAlert 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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 (activityLogAlert !== null && activityLogAlert !== undefined) { + let requestModelMapper = new client.models['ActivityLogAlertResource']().mapper(); + requestModel = client.serialize(requestModelMapper, activityLogAlert, 'activityLogAlert'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(activityLogAlert, 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['ActivityLogAlertResource']().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['ActivityLogAlertResource']().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); + }); +} + +/** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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 ActivityLogAlertResource} 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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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['ActivityLogAlertResource']().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); + }); +} + +/** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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); + }); +} + +/** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { + throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); + } + if (activityLogAlertPatch === null || activityLogAlertPatch === undefined) { + throw new Error('activityLogAlertPatch 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/activityLogAlerts/{activityLogAlertName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); + 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 (activityLogAlertPatch !== null && activityLogAlertPatch !== undefined) { + let requestModelMapper = new client.models['ActivityLogAlertPatchBody']().mapper(); + requestModel = client.serialize(requestModelMapper, activityLogAlertPatch, 'activityLogAlertPatch'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(activityLogAlertPatch, 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['ActivityLogAlertResource']().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); + }); +} + +/** + * Get a list of all activity log alerts in 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 ActivityLogAlertList} 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 _listBySubscriptionId(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 = '2017-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/activityLogAlerts'; + 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['ActivityLogAlertList']().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); + }); +} + +/** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 ActivityLogAlertList} 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 apiVersion = '2017-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 (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 (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/activityLogAlerts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ActivityLogAlertList']().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 ActivityLogAlerts. */ +class ActivityLogAlerts { + /** + * Create a ActivityLogAlerts. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listBySubscriptionId = _listBySubscriptionId; + this._listByResourceGroup = _listByResourceGroup; + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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, activityLogAlertName, activityLogAlert, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, optionalCallback); + } + } + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, activityLogAlertName, options, optionalCallback); + } + } + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, activityLogAlertName, options, optionalCallback); + } + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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, activityLogAlertName, activityLogAlertPatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, optionalCallback); + } + } + + /** + * Get a list of all activity log alerts in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionId(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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. + */ + listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionId(options, optionalCallback); + } + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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 = ActivityLogAlerts; diff --git a/lib/services/monitor/lib/lib/operations/activityLogs.js b/lib/services/monitor/lib/lib/operations/activityLogs.js new file mode 100644 index 0000000000..7128d017ab --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/activityLogs.js @@ -0,0 +1,545 @@ +/* + * 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; + +/** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; + let apiVersion = '2015-04-01'; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { + throw new Error('select 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/eventtypes/management/values'; + 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 (select !== null && select !== undefined) { + queryParameters.push('$select=' + encodeURIComponent(select)); + } + 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['EventDataCollection']().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); + }); +} + +/** + * Provides the list of records from the activity logs. + * + * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 ActivityLogs. */ +class ActivityLogs { + /** + * Create a ActivityLogs. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Provides the list of records from the activity logs. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ActivityLogs; diff --git a/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js b/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js new file mode 100644 index 0000000000..fac095135e --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js @@ -0,0 +1,500 @@ +/* + * 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; + +/** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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 Incident} 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, incidentName, 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 (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 (incidentName === null || incidentName === undefined || typeof incidentName.valueOf() !== 'string') { + throw new Error('incidentName 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/alertrules/{ruleName}/incidents/{incidentName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{incidentName}', encodeURIComponent(incidentName)); + 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['Incident']().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); + }); +} + +/** + * Gets a list of incidents associated to an alert 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 IncidentListResult} 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 _listByAlertRule(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 = '2016-03-01'; + // 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/alertrules/{ruleName}/incidents'; + 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) { + 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['IncidentListResult']().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 AlertRuleIncidents. */ +class AlertRuleIncidents { + /** + * Create a AlertRuleIncidents. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._listByAlertRule = _listByAlertRule; + } + + /** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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, incidentName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, ruleName, incidentName, 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 incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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 {Incident} - 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 Incident} 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, incidentName, 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, incidentName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, ruleName, incidentName, options, optionalCallback); + } + } + + /** + * Gets a list of incidents associated to an alert 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. + */ + listByAlertRuleWithHttpOperationResponse(resourceGroupName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAlertRule(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 a list of incidents associated to an alert 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 {IncidentListResult} - 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 IncidentListResult} 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. + */ + listByAlertRule(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._listByAlertRule(resourceGroupName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAlertRule(resourceGroupName, ruleName, options, optionalCallback); + } + } + +} + +module.exports = AlertRuleIncidents; diff --git a/lib/services/monitor/lib/lib/operations/alertRules.js b/lib/services/monitor/lib/lib/operations/alertRules.js new file mode 100644 index 0000000000..3676f74c97 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/alertRules.js @@ -0,0 +1,1423 @@ +/* + * 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 alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 AlertRuleResource} 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 = '2016-03-01'; + // 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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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/alertrules/{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 = '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['AlertRuleResource']().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['AlertRuleResource']().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['AlertRuleResource']().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); + }); +} + +/** + * Deletes an alert 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 = '2016-03-01'; + // 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/alertrules/{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) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets an alert 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 AlertRuleResource} 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 = '2016-03-01'; + // 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/alertrules/{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) { + 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['AlertRuleResource']().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); + }); +} + +/** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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 AlertRuleResource} 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, alertRulesResource, 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 (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 (alertRulesResource === null || alertRulesResource === undefined) { + throw new Error('alertRulesResource 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/alertrules/{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 (alertRulesResource !== null && alertRulesResource !== undefined) { + let requestModelMapper = new client.models['AlertRuleResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, alertRulesResource, 'alertRulesResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(alertRulesResource, 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['AlertRuleResource']().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['AlertRuleResource']().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); + }); +} + +/** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 _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 apiVersion = '2016-03-01'; + // 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 (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/alertrules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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 { + /** + * Create a AlertRules. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listByResourceGroup = _listByResourceGroup; + } + + /** + * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {AlertRuleResource} - 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 AlertRuleResource} 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); + } + } + + /** + * Deletes an alert 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 an alert 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); + } + } + + /** + * Gets an alert 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 alert 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 {AlertRuleResource} - 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 AlertRuleResource} 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); + } + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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, alertRulesResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, ruleName, alertRulesResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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 {AlertRuleResource} - 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 AlertRuleResource} 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, alertRulesResource, 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, alertRulesResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, ruleName, alertRulesResource, options, optionalCallback); + } + } + + /** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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 alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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 = AlertRules; diff --git a/lib/services/monitor/lib/lib/operations/autoscaleSettings.js b/lib/services/monitor/lib/lib/operations/autoscaleSettings.js new file mode 100644 index 0000000000..a65507da16 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/autoscaleSettings.js @@ -0,0 +1,1561 @@ +/* + * 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; + +/** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 _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 apiVersion = '2015-04-01'; + // 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 (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/autoscalesettings'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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); + }); +} + +/** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 = '2015-04-01'; + // 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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName 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.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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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 = '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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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); + }); +} + +/** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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); + }); +} + +/** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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['AutoscaleSettingResource']().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); + }); +} + +/** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { + throw new Error('autoscaleSettingName cannot be null or undefined and it must be of type string.'); + } + if (autoscaleSettingResource === null || autoscaleSettingResource === undefined) { + throw new Error('autoscaleSettingResource 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/autoscalesettings/{autoscaleSettingName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); + 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 (autoscaleSettingResource !== null && autoscaleSettingResource !== undefined) { + let requestModelMapper = new client.models['AutoscaleSettingResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, autoscaleSettingResource, 'autoscaleSettingResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(autoscaleSettingResource, 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['AutoscaleSettingResource']().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 + * + * @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 _listByResourceGroupNext(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 { + /** + * Create a AutoscaleSettings. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByResourceGroup = _listByResourceGroup; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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); + } + } + + /** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, autoscaleSettingName, 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 autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, autoscaleSettingName, parameters, options, optionalCallback); + } + } + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, autoscaleSettingName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, autoscaleSettingName, options, optionalCallback); + } + } + + /** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, autoscaleSettingName, 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 autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, autoscaleSettingName, options, optionalCallback); + } + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName, autoscaleSettingResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, optionalCallback); + } + } + + /** + * Lists the autoscale settings for a resource group + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(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 resource group + * + * @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. + */ + listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = AutoscaleSettings; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js new file mode 100644 index 0000000000..551dd62984 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js @@ -0,0 +1,479 @@ +/* + * 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; + +/** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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['DiagnosticSettingsCategoryResource']().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 diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 + * DiagnosticSettingsCategoryResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + 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['DiagnosticSettingsCategoryResourceCollection']().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 DiagnosticSettingsCategoryOperations. */ +class DiagnosticSettingsCategoryOperations { + /** + * Create a DiagnosticSettingsCategoryOperations. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._list = _list; + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceUri, name, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsCategoryResource} - 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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceUri, name, options, optionalCallback); + } + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, 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 diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsCategoryResourceCollection} - 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 + * DiagnosticSettingsCategoryResourceCollection} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = DiagnosticSettingsCategoryOperations; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js new file mode 100644 index 0000000000..be6f0864d9 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js @@ -0,0 +1,991 @@ +/* + * 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; + +/** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 DiagnosticSettingsResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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['DiagnosticSettingsResource']().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); + }); +} + +/** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri 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 (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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['DiagnosticSettingsResource']().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['DiagnosticSettingsResource']().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 existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + 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); + }); +} + +/** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 DiagnosticSettingsResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + 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['DiagnosticSettingsResourceCollection']().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 DiagnosticSettingsOperations. */ +class DiagnosticSettingsOperations { + /** + * Create a DiagnosticSettingsOperations. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._list = _list; + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceUri, name, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceUri, name, options, optionalCallback); + } + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, parameters, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceUri, parameters, name, 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 diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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(resourceUri, parameters, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceUri, parameters, name, options, optionalCallback); + } + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceUri, name, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceUri, name, options, optionalCallback); + } + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsResourceCollection} - 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 DiagnosticSettingsResourceCollection} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = DiagnosticSettingsOperations; diff --git a/lib/services/monitor/lib/lib/operations/eventCategories.js b/lib/services/monitor/lib/lib/operations/eventCategories.js new file mode 100644 index 0000000000..b9705aa81a --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/eventCategories.js @@ -0,0 +1,244 @@ +/* + * 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; + +/** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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 EventCategoryCollection} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/eventcategories'; + 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['EventCategoryCollection']().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 EventCategories. */ +class EventCategories { + /** + * Create a EventCategories. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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 {EventCategoryCollection} - 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 EventCategoryCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = EventCategories; diff --git a/lib/services/monitor/lib/lib/operations/index.d.ts b/lib/services/monitor/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..f6c6bd1a66 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/index.d.ts @@ -0,0 +1,4284 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as moment from 'moment'; +import * as models from '../models'; + + +/** + * @class + * AutoscaleSettings + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface AutoscaleSettings { + + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the autoscale settings for a resource group + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + + + /** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an autoscale setting. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {array} parameters.profiles the collection of automatic scaling + * profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + * + * @param {array} [parameters.notifications] the collection of notifications. + * + * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether + * automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param {string} [parameters.autoscaleSettingResourceName] the name of the + * autoscale setting. + * + * @param {string} [parameters.targetResourceUri] the resource identifier of + * the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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. + * + * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes and autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets an autoscale setting + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @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 {AutoscaleSettingResource} - 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. + * + * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use + * the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} autoscaleSettingName The autoscale setting name. + * + * @param {object} autoscaleSettingResource Parameters supplied to the + * operation. + * + * @param {object} [autoscaleSettingResource.tags] Resource tags + * + * @param {array} autoscaleSettingResource.profiles the collection of automatic + * scaling profiles that specify different scaling parameters for different + * time periods. A maximum of 20 profiles can be specified. + * + * @param {array} [autoscaleSettingResource.notifications] the collection of + * notifications. + * + * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. + * Specifies whether automatic scaling is enabled for the resource. The default + * value is 'true'. + * + * @param {string} [autoscaleSettingResource.name] the name of the autoscale + * setting. + * + * @param {string} [autoscaleSettingResource.targetResourceUri] the resource + * identifier of the resource that the autoscale setting should be added to. + * + * @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 {AutoscaleSettingResource} - 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. + * + * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. + * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the autoscale settings for a resource group + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the autoscale settings for a resource group + * + * @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. + */ + 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; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AlertRuleIncidents + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface AlertRuleIncidents { + + + /** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets an incident associated to an alert rule + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} incidentName The name of the incident to retrieve. + * + * @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 {Incident} - 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. + * + * {Incident} [result] - The deserialized result object if an error did not occur. + * See {@link Incident} 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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, ruleName: string, incidentName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, ruleName: string, incidentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of incidents associated to an alert 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. + */ + listByAlertRuleWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of incidents associated to an alert 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 {IncidentListResult} - 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. + * + * {IncidentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link IncidentListResult} 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. + */ + listByAlertRule(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAlertRule(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; + listByAlertRule(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AlertRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface AlertRules { + + + /** + * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. + * + * @param {string} [parameters.description] the description of the alert rule + * that will be included in the alert email. + * + * @param {boolean} parameters.isEnabled the flag that indicates whether the + * alert rule is enabled. + * + * @param {object} parameters.condition the condition that results in the alert + * rule being activated. + * + * @param {object} [parameters.condition.dataSource] the resource from which + * the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + * + * @param {string} [parameters.condition.dataSource.resourceUri] the resource + * identifier of the resource the rule monitors. **NOTE**: this property cannot + * be updated for an existing rule. + * + * @param {string} parameters.condition.dataSource.odatatype Polymorphic + * Discriminator + * + * @param {string} parameters.condition.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {AlertRuleResource} - 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. + * + * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResource} 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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an alert 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 an alert 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; + + + /** + * Gets an alert 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 alert 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 {AlertRuleResource} - 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. + * + * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResource} 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; + + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing AlertRuleResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} alertRulesResource Parameters supplied to the operation. + * + * @param {object} [alertRulesResource.tags] Resource tags + * + * @param {string} alertRulesResource.name the name of the alert rule. + * + * @param {string} [alertRulesResource.description] the description of the + * alert rule that will be included in the alert email. + * + * @param {boolean} alertRulesResource.isEnabled the flag that indicates + * whether the alert rule is enabled. + * + * @param {object} alertRulesResource.condition the condition that results in + * the alert rule being activated. + * + * @param {object} [alertRulesResource.condition.dataSource] the resource from + * which the rule collects its data. For this type dataSource will always be of + * type RuleMetricDataSource. + * + * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the + * resource identifier of the resource the rule monitors. **NOTE**: this + * property cannot be updated for an existing rule. + * + * @param {string} alertRulesResource.condition.dataSource.odatatype + * Polymorphic Discriminator + * + * @param {string} alertRulesResource.condition.odatatype Polymorphic + * Discriminator + * + * @param {array} [alertRulesResource.actions] the array of actions that are + * performed when the alert rule becomes active, and when an alert condition is + * resolved. + * + * @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 {AlertRuleResource} - 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. + * + * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. + * See {@link AlertRuleResource} 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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the alert rules within a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; +} + +/** + * @class + * LogProfiles + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface LogProfiles { + + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(logProfileName: string, callback: ServiceCallback): void; + deleteMethod(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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 {LogProfileResource} - 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. + * + * {LogProfileResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileResource} 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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(logProfileName: string, callback: ServiceCallback): void; + get(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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. + * + * {LogProfileResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileResource} 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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, callback: ServiceCallback): void; + createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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. + * + * {LogProfileResource} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileResource} 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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, callback: ServiceCallback): void; + update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List the log profiles. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List the log profiles. + * + * @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 {LogProfileCollection} - 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. + * + * {LogProfileCollection} [result] - The deserialized result object if an error did not occur. + * See {@link LogProfileCollection} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DiagnosticSettingsOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface DiagnosticSettingsOperations { + + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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. + * + * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceUri: string, name: string, callback: ServiceCallback): void; + get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] The resource ID of the storage + * account to which you would like to send Diagnostic Logs. + * + * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for + * the event hub authorization rule. + * + * @param {string} [parameters.eventHubName] The name of the event hub. If none + * is specified, the default event hub will be selected. + * + * @param {array} [parameters.metrics] the list of metric settings. + * + * @param {array} [parameters.logs] the list of logs settings. + * + * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a + * Log Analytics workspace) for a Log Analytics workspace to which you would + * like to send Diagnostic Logs. Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsResource} - 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. + * + * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsResource} 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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, callback: ServiceCallback): void; + createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceUri: string, name: string, callback: ServiceCallback): void; + deleteMethod(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsResourceCollection} - 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. + * + * {DiagnosticSettingsResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsResourceCollection} 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. + */ + list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DiagnosticSettingsCategoryOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface DiagnosticSettingsCategoryOperations { + + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {string} name The name of the diagnostic setting. + * + * @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 {DiagnosticSettingsCategoryResource} - 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. + * + * {DiagnosticSettingsCategoryResource} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticSettingsCategoryResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceUri: string, name: string, callback: ServiceCallback): void; + get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @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 {DiagnosticSettingsCategoryResourceCollection} - 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. + * + * {DiagnosticSettingsCategoryResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link + * DiagnosticSettingsCategoryResourceCollection} 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. + */ + list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActionGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ActionGroups { + + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new action group or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroup The action group to create or use for the + * update. + * + * @param {string} actionGroup.groupShortName The short name of the action + * group. This will be used in SMS messages. + * + * @param {boolean} actionGroup.enabled Indicates whether this action group is + * enabled. If an action group is not enabled, then none of its receivers will + * receive communications. + * + * @param {array} [actionGroup.emailReceivers] The list of email receivers that + * are part of this action group. + * + * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are + * part of this action group. + * + * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers + * that are part of this action group. + * + * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that + * are part of this action group. + * + * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush + * receivers that are part of this action group. + * + * @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 + * + * @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 {ActionGroupResource} - 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. + * + * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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 {ActionGroupResource} - 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. + * + * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupResource} 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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an action group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing action group's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {object} actionGroupPatch Parameters supplied to the operation. + * + * @param {object} [actionGroupPatch.tags] Resource tags + * + * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action + * group is enabled. If an action group is not enabled, then none of its + * actions will be activated. + * + * @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 {ActionGroupResource} - 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. + * + * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, callback: ServiceCallback): void; + update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all action groups in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all action groups in 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 {ActionGroupList} - 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. + * + * {ActionGroupList} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupList} 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. + */ + listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionId(callback: ServiceCallback): void; + listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all action groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActionGroupList} - 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. + * + * {ActionGroupList} [result] - The deserialized result object if an error did not occur. + * See {@link ActionGroupList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiverWithHttpOperationResponse(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Enable a receiver in an action group. This changes the receiver's status + * from Disabled to Enabled. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} actionGroupName The name of the action group. + * + * @param {string} receiverName The name of the receiver to resubscribe. + * + * @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. + */ + enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, callback: ServiceCallback): void; + enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActivityLogAlerts + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ActivityLogAlerts { + + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new activity log alert or update an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlert The activity log alert to create or use for + * the update. + * + * @param {array} activityLogAlert.scopes A list of resourceIds that will be + * used as prefixes. The alert will only apply to activityLogs with resourceIds + * that fall under one of these prefixes. This list must include at least one + * item. + * + * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity + * log alert is enabled. If an activity log alert is not enabled, then none of + * its actions will be activated. + * + * @param {object} activityLogAlert.condition The condition that will cause + * this alert to activate. + * + * @param {array} activityLogAlert.condition.allOf The list of activity log + * alert conditions. + * + * @param {object} activityLogAlert.actions The actions that will activate when + * the condition is met. + * + * @param {array} [activityLogAlert.actions.actionGroups] The list of activity + * log alerts. + * + * @param {string} [activityLogAlert.description] A description of this + * activity log alert. + * + * @param {string} activityLogAlert.location Resource location + * + * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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. + * + * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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 {ActivityLogAlertResource} - 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. + * + * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an activity log alert. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields + * use the CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} activityLogAlertName The name of the activity log alert. + * + * @param {object} activityLogAlertPatch Parameters supplied to the operation. + * + * @param {object} [activityLogAlertPatch.tags] Resource tags + * + * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this + * activity log alert is enabled. If an activity log alert is not enabled, then + * none of its actions will be activated. + * + * @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 {ActivityLogAlertResource} - 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. + * + * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, callback: ServiceCallback): void; + update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all activity log alerts in 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. + */ + listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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. + * + * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertList} 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. + */ + listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionId(callback: ServiceCallback): void; + listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ActivityLogAlertList} - 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. + * + * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityLogAlertList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActivityLogs + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface ActivityLogs { + + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provides the list of records from the activity logs. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** argument is very restricted and allows only the following + * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq + * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp + * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List + * events for a subscription in a time range*: $filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq + * 'resourceProviderName'.
- *List events for a correlation Id*: + * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp + * le '2014-07-20T04:36:37.6407898Z' and correlationId eq + * 'correlationID'.

**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Provides the list of records from the activity logs. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Provides the list of records from the activity logs. + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * EventCategories + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface EventCategories { + + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the list of available event categories supported in the Activity Logs + * Service.
The current list includes the following: Administrative, + * Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @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 {EventCategoryCollection} - 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. + * + * {EventCategoryCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventCategoryCollection} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TenantActivityLogs + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface TenantActivityLogs { + + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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 {EventDataCollection} - 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. + * + * {EventDataCollection} [result] - The deserialized result object if an error did not occur. + * See {@link EventDataCollection} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * MetricDefinitions + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricDefinitions { + + + /** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {MetricDefinitionCollection} - 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. + * + * {MetricDefinitionCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricDefinitionCollection} 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. + */ + list(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Metrics + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface Metrics { + + + /** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {Response} - 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. + * + * {Response} [result] - The deserialized result object if an error did not occur. + * See {@link Response} 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. + */ + list(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceUri: string, callback: ServiceCallback): void; + list(resourceUri: string, options: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * MetricBaseline + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricBaseline { + + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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 {BaselineResponse} - 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. + * + * {BaselineResponse} [result] - The deserialized result object if an error did not occur. + * See {@link BaselineResponse} 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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceUri: string, metricName: string, callback: ServiceCallback): void; + get(resourceUri: string, metricName: string, options: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * **Lists the baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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. + */ + calculateBaselineWithHttpOperationResponse(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * **Lists the baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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 {CalculateBaselineResponse} - 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. + * + * {CalculateBaselineResponse} [result] - The deserialized result object if an error did not occur. + * See {@link CalculateBaselineResponse} 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. + */ + calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, callback: ServiceCallback): void; + calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * MetricAlerts + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricAlerts { + + + /** + * Retrieve alert rule definitions in 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>; + + /** + * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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. + * + * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResourceCollection} 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; + + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {MetricAlertResourceCollection} - 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. + * + * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResourceCollection} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve an alert rule definiton. + * + * @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>; + + /** + * Retrieve an alert rule definiton. + * + * @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 {MetricAlertResource} - 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. + * + * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResource} 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; + + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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. + * + * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResource} 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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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. + * + * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertResource} 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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, callback: ServiceCallback): void; + update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an alert rule defitiniton. + * + * @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>; + + /** + * Delete an alert rule defitiniton. + * + * @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; +} + +/** + * @class + * MetricAlertsStatus + * __NOTE__: An instance of this class is automatically created for an + * instance of the MonitorManagementClient. + */ +export interface MetricAlertsStatus { + + + /** + * Retrieve an alert rule status. + * + * @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. + */ + listWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve an alert rule status. + * + * @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 {MetricAlertStatusCollection} - 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. + * + * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertStatusCollection} 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. + */ + list(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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. + */ + listByNameWithHttpOperationResponse(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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 {MetricAlertStatusCollection} - 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. + * + * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. + * See {@link MetricAlertStatusCollection} 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. + */ + listByName(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + 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; +} diff --git a/lib/services/monitor/lib/lib/operations/index.js b/lib/services/monitor/lib/lib/operations/index.js new file mode 100644 index 0000000000..56d8f5aa1b --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/index.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.AutoscaleSettings = require('./autoscaleSettings'); +exports.Operations = require('./operations'); +exports.AlertRuleIncidents = require('./alertRuleIncidents'); +exports.AlertRules = require('./alertRules'); +exports.LogProfiles = require('./logProfiles'); +exports.DiagnosticSettingsOperations = require('./diagnosticSettingsOperations'); +exports.DiagnosticSettingsCategoryOperations = require('./diagnosticSettingsCategoryOperations'); +exports.ActionGroups = require('./actionGroups'); +exports.ActivityLogAlerts = require('./activityLogAlerts'); +exports.ActivityLogs = require('./activityLogs'); +exports.EventCategories = require('./eventCategories'); +exports.TenantActivityLogs = require('./tenantActivityLogs'); +exports.MetricDefinitions = require('./metricDefinitions'); +exports.Metrics = require('./metrics'); +exports.MetricBaseline = require('./metricBaseline'); +exports.MetricAlerts = require('./metricAlerts'); +exports.MetricAlertsStatus = require('./metricAlertsStatus'); diff --git a/lib/services/monitor/lib/lib/operations/logProfiles.js b/lib/services/monitor/lib/lib/operations/logProfiles.js new file mode 100644 index 0000000000..8c61a074e5 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/logProfiles.js @@ -0,0 +1,1319 @@ +/* + * 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; + +/** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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 LogProfileResource} 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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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['LogProfileResource']().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); + }); +} + +/** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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 LogProfileResource} 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(logProfileName, 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 = '2016-03-01'; + // Validate + try { + if (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName 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.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/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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 = '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['LogProfileResource']().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) { + 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['LogProfileResource']().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); + }); +} + +/** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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 LogProfileResource} 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(logProfileName, logProfilesResource, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { + throw new Error('logProfileName cannot be null or undefined and it must be of type string.'); + } + if (logProfilesResource === null || logProfilesResource === undefined) { + throw new Error('logProfilesResource 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); + 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 (logProfilesResource !== null && logProfilesResource !== undefined) { + let requestModelMapper = new client.models['LogProfileResourcePatch']().mapper(); + requestModel = client.serialize(requestModelMapper, logProfilesResource, 'logProfilesResource'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(logProfilesResource, 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['LogProfileResource']().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 profiles. + * + * @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 LogProfileCollection} 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 _list(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/logprofiles'; + 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['LogProfileCollection']().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 LogProfiles. */ +class LogProfiles { + /** + * Create a LogProfiles. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._list = _list; + } + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(logProfileName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(logProfileName, options, optionalCallback); + } + } + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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(logProfileName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(logProfileName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the log profile. + * + * @param {string} logProfileName The name of the log profile. + * + * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(logProfileName, options, optionalCallback); + } + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(logProfileName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} parameters Parameters supplied to the operation. + * + * @param {string} [parameters.storageAccountId] the resource id of the storage + * account to which you would like to send the Activity Log. + * + * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the + * service bus namespace in which you would like to have Event Hubs created for + * streaming the Activity Log. The rule ID is of the format: '{service bus + * resource ID}/authorizationrules/{key name}'. + * + * @param {array} parameters.locations List of regions for which Activity Log + * events should be stored or streamed. It is a comma separated list of valid + * ARM locations including the 'global' location. + * + * @param {array} parameters.categories the categories of the logs. These + * categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} parameters.retentionPolicy the retention policy for the + * events in the log. + * + * @param {boolean} parameters.retentionPolicy.enabled a value indicating + * whether the retention policy is enabled. + * + * @param {number} parameters.retentionPolicy.days the number of days for the + * retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(logProfileName, parameters, options, optionalCallback); + } + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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(logProfileName, logProfilesResource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(logProfileName, logProfilesResource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} logProfileName The name of the log profile. + * + * @param {object} logProfilesResource Parameters supplied to the operation. + * + * @param {object} [logProfilesResource.tags] Resource tags + * + * @param {string} [logProfilesResource.storageAccountId] the resource id of + * the storage account to which you would like to send the Activity Log. + * + * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule + * ID of the service bus namespace in which you would like to have Event Hubs + * created for streaming the Activity Log. The rule ID is of the format: + * '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param {array} logProfilesResource.locations List of regions for which + * Activity Log events should be stored or streamed. It is a comma separated + * list of valid ARM locations including the 'global' location. + * + * @param {array} logProfilesResource.categories the categories of the logs. + * These categories are created as is convenient to the user. Some values are: + * 'Write', 'Delete', and/or 'Action.' + * + * @param {object} logProfilesResource.retentionPolicy the retention policy for + * the events in the log. + * + * @param {boolean} logProfilesResource.retentionPolicy.enabled a value + * indicating whether the retention policy is enabled. + * + * @param {number} logProfilesResource.retentionPolicy.days the number of days + * for the retention in days. A value of 0 will retain the events indefinitely. + * + * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, logProfilesResource, 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(logProfileName, logProfilesResource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(logProfileName, logProfilesResource, options, optionalCallback); + } + } + + /** + * List the log profiles. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 profiles. + * + * @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 {LogProfileCollection} - 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 LogProfileCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = LogProfiles; diff --git a/lib/services/monitor/lib/lib/operations/metricAlerts.js b/lib/services/monitor/lib/lib/operations/metricAlerts.js new file mode 100644 index 0000000000..d8cdf644dc --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricAlerts.js @@ -0,0 +1,1590 @@ +/* + * 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; +const moment = require('moment'); + +/** + * Retrieve alert rule definitions in 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 MetricAlertResourceCollection} 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 = '2018-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.Insight/metricAlerts'; + 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['MetricAlertResourceCollection']().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); + }); +} + +/** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 MetricAlertResourceCollection} 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 apiVersion = '2018-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 (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 (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.Insight/metricAlerts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['MetricAlertResourceCollection']().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); + }); +} + +/** + * Retrieve an alert rule definiton. + * + * @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 MetricAlertResource} 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-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 (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.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.Insight/metricAlerts/{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 = '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['MetricAlertResource']().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); + }); +} + +/** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 MetricAlertResource} 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-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 (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.Insight/metricAlerts/{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['MetricAlertResource']().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['MetricAlertResource']().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 an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 MetricAlertResource} 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-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 (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.Insight/metricAlerts/{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['MetricAlertResourcePatch']().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['MetricAlertResource']().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); + }); +} + +/** + * Delete an alert rule defitiniton. + * + * @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-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 (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.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.Insight/metricAlerts/{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 = '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) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a MetricAlerts. */ +class MetricAlerts { + /** + * Create a MetricAlerts. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySubscription = _listBySubscription; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + } + + /** + * Retrieve alert rule definitions in 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; + }); + }); + } + + /** + * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); + } + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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. + */ + 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; + }); + }); + } + + /** + * Retrieve alert rule defintions in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); + } + } + + /** + * Retrieve an alert rule definiton. + * + * @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; + }); + }); + } + + /** + * Retrieve an alert rule definiton. + * + * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); + } + } + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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; + }); + }); + } + + /** + * Create or update an metric alert definition. + * + * @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 metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); + } + } + + /** + * Update an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 an metric alert definition. + * + * @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.description the description of the metric alert + * that will be included in the alert email. + * + * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} + * + * @param {boolean} parameters.enabled the flag that indicates whether the + * metric alert is enabled. + * + * @param {array} [parameters.scopes] the list of resource id's that this + * metric alert is scoped to. + * + * @param {moment.duration} parameters.evaluationFrequency how often the metric + * alert is evaluated represented in ISO 8601 duration format. + * + * @param {moment.duration} parameters.windowSize the period of time (in ISO + * 8601 duration format) that is used to monitor alert activity based on the + * threshold. + * + * @param {object} parameters.criteria defines the specific alert criteria + * information. + * + * @param {string} parameters.criteria.odatatype Polymorphic Discriminator + * + * @param {array} [parameters.actions] the array of actions that are performed + * when the alert rule becomes active, and when an alert condition is resolved. + * + * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); + } + } + + /** + * Delete an alert rule defitiniton. + * + * @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; + }); + }); + } + + /** + * Delete an alert rule defitiniton. + * + * @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); + } + } + +} + +module.exports = MetricAlerts; diff --git a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js new file mode 100644 index 0000000000..7bd81a8494 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js @@ -0,0 +1,505 @@ +/* + * 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; + +/** + * Retrieve an alert rule status. + * + * @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 MetricAlertStatusCollection} 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 _list(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-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 (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.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.Insight/metricAlerts/{ruleName}/status'; + 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 = '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['MetricAlertStatusCollection']().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); + }); +} + +/** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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 MetricAlertStatusCollection} 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 _listByName(resourceGroupName, ruleName, statusName, 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-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 (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 (statusName === null || statusName === undefined || typeof statusName.valueOf() !== 'string') { + throw new Error('statusName 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.Insight/metricAlerts/{ruleName}/status/{statusName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{statusName}', encodeURIComponent(statusName)); + 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['MetricAlertStatusCollection']().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 MetricAlertsStatus. */ +class MetricAlertsStatus { + /** + * Create a MetricAlertsStatus. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByName = _listByName; + } + + /** + * Retrieve an alert rule status. + * + * @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. + */ + listWithHttpOperationResponse(resourceGroupName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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; + }); + }); + } + + /** + * Retrieve an alert rule status. + * + * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. + */ + list(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._list(resourceGroupName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, ruleName, options, optionalCallback); + } + } + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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. + */ + listByNameWithHttpOperationResponse(resourceGroupName, ruleName, statusName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve an alert rule status. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ruleName The name of the rule. + * + * @param {string} statusName The name of the status. + * + * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. + */ + listByName(resourceGroupName, ruleName, statusName, 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._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByName(resourceGroupName, ruleName, statusName, options, optionalCallback); + } + } + +} + +module.exports = MetricAlertsStatus; diff --git a/lib/services/monitor/lib/lib/operations/metricBaseline.js b/lib/services/monitor/lib/lib/operations/metricBaseline.js new file mode 100644 index 0000000000..365ca4990c --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricBaseline.js @@ -0,0 +1,642 @@ +/* + * 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; +const moment = require('moment'); + +/** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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 BaselineResponse} 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(resourceUri, metricName, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; + let interval = (options && options.interval !== undefined) ? options.interval : undefined; + let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; + let sensitivities = (options && options.sensitivities !== undefined) ? options.sensitivities : undefined; + let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; + let apiVersion = '2017-11-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (metricName === null || metricName === undefined || typeof metricName.valueOf() !== 'string') { + throw new Error('metricName cannot be null or undefined and it must be of type string.'); + } + if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { + throw new Error('timespan must be of type string.'); + } + if(interval && !moment.isDuration(interval)) { + throw new Error('interval must be of type moment.duration.'); + } + if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { + throw new Error('aggregation must be of type string.'); + } + if (sensitivities !== null && sensitivities !== undefined && typeof sensitivities.valueOf() !== 'string') { + throw new Error('sensitivities must be of type string.'); + } + if (resultType) { + let allowedValues = [ 'Data', 'Metadata' ]; + if (!allowedValues.some( function(item) { return item === resultType; })) { + throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/baseline/{metricName}'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + requestUrl = requestUrl.replace('{metricName}', encodeURIComponent(metricName)); + let queryParameters = []; + if (timespan !== null && timespan !== undefined) { + queryParameters.push('timespan=' + encodeURIComponent(timespan)); + } + if (interval !== null && interval !== undefined) { + queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); + } + if (aggregation !== null && aggregation !== undefined) { + queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); + } + if (sensitivities !== null && sensitivities !== undefined) { + queryParameters.push('sensitivities=' + encodeURIComponent(sensitivities)); + } + if (resultType !== null && resultType !== undefined) { + queryParameters.push('resultType=' + encodeURIComponent(resultType)); + } + 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['BaselineResponse']().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 baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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 CalculateBaselineResponse} 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 _calculateBaseline(resourceUri, timeSeriesInformation, 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 = '2017-11-01-preview'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (timeSeriesInformation === null || timeSeriesInformation === undefined) { + throw new Error('timeSeriesInformation 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/calculatebaseline'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + 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 = 'POST'; + 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 (timeSeriesInformation !== null && timeSeriesInformation !== undefined) { + let requestModelMapper = new client.models['TimeSeriesInformation']().mapper(); + requestModel = client.serialize(requestModelMapper, timeSeriesInformation, 'timeSeriesInformation'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(timeSeriesInformation, 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['CalculateBaselineResponse']().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 MetricBaseline. */ +class MetricBaseline { + /** + * Create a MetricBaseline. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._calculateBaseline = _calculateBaseline; + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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(resourceUri, metricName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceUri, metricName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {string} metricName The name of the metric to retrieve the baseline + * for. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.aggregation] The aggregation type of the metric to + * retrieve the baseline for. + * + * @param {string} [options.sensitivities] The list of sensitivities (comma + * separated) to retrieve. + * + * @param {string} [options.resultType] Allows retrieving only metadata of the + * baseline. On data request all information is retrieved. Possible values + * include: 'Data', 'Metadata' + * + * @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 {BaselineResponse} - 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 BaselineResponse} 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(resourceUri, metricName, 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(resourceUri, metricName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceUri, metricName, options, optionalCallback); + } + } + + /** + * **Lists the baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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. + */ + calculateBaselineWithHttpOperationResponse(resourceUri, timeSeriesInformation, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._calculateBaseline(resourceUri, timeSeriesInformation, 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 baseline values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. It has the + * following structure: + * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. + * For example: + * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * + * @param {object} timeSeriesInformation Information that need to be specified + * to calculate a baseline on a time series. + * + * @param {array} timeSeriesInformation.sensitivities the list of sensitivities + * for calculating the baseline. + * + * @param {array} timeSeriesInformation.values The metric values to calculate + * the baseline. + * + * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of + * the baselines. + * + * @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 {CalculateBaselineResponse} - 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 CalculateBaselineResponse} 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. + */ + calculateBaseline(resourceUri, timeSeriesInformation, 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._calculateBaseline(resourceUri, timeSeriesInformation, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._calculateBaseline(resourceUri, timeSeriesInformation, options, optionalCallback); + } + } + +} + +module.exports = MetricBaseline; diff --git a/lib/services/monitor/lib/lib/operations/metricDefinitions.js b/lib/services/monitor/lib/lib/operations/metricDefinitions.js new file mode 100644 index 0000000000..f3d1817183 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metricDefinitions.js @@ -0,0 +1,264 @@ +/* + * 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; + +/** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 MetricDefinitionCollection} 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 _list(resourceUri, 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 metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; + let apiVersion = '2018-01-01'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { + throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metricDefinitions'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (metricnamespace !== null && metricnamespace !== undefined) { + queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); + } + 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['MetricDefinitionCollection']().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 MetricDefinitions. */ +class MetricDefinitions { + /** + * Create a MetricDefinitions. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Lists the metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, 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 metric definitions for the resource. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {MetricDefinitionCollection} - 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 MetricDefinitionCollection} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = MetricDefinitions; diff --git a/lib/services/monitor/lib/lib/operations/metrics.js b/lib/services/monitor/lib/lib/operations/metrics.js new file mode 100644 index 0000000000..02d0aa5489 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/metrics.js @@ -0,0 +1,430 @@ +/* + * 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; +const moment = require('moment'); + +/** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 Response} 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 _list(resourceUri, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; + let interval = (options && options.interval !== undefined) ? options.interval : undefined; + let metricnames = (options && options.metricnames !== undefined) ? options.metricnames : undefined; + let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; + let metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; + let apiVersion = '2018-01-01'; + // Validate + try { + if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { + throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); + } + if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { + throw new Error('timespan must be of type string.'); + } + if(interval && !moment.isDuration(interval)) { + throw new Error('interval must be of type moment.duration.'); + } + if (metricnames !== null && metricnames !== undefined && typeof metricnames.valueOf() !== 'string') { + throw new Error('metricnames must be of type string.'); + } + if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { + throw new Error('aggregation must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { + throw new Error('orderby must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (resultType) { + let allowedValues = [ 'Data', 'Metadata' ]; + if (!allowedValues.some( function(item) { return item === resultType; })) { + throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { + throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metrics'; + requestUrl = requestUrl.replace('{resourceUri}', resourceUri); + let queryParameters = []; + if (timespan !== null && timespan !== undefined) { + queryParameters.push('timespan=' + encodeURIComponent(timespan)); + } + if (interval !== null && interval !== undefined) { + queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); + } + if (metricnames !== null && metricnames !== undefined) { + queryParameters.push('metricnames=' + encodeURIComponent(metricnames)); + } + if (aggregation !== null && aggregation !== undefined) { + queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); + } + if (top !== null && top !== undefined) { + queryParameters.push('top=' + encodeURIComponent(top.toString())); + } + if (orderby !== null && orderby !== undefined) { + queryParameters.push('orderby=' + encodeURIComponent(orderby)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (resultType !== null && resultType !== undefined) { + queryParameters.push('resultType=' + encodeURIComponent(resultType)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (metricnamespace !== null && metricnamespace !== undefined) { + queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); + } + 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['Response']().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 Metrics. */ +class Metrics { + /** + * Create a Metrics. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * **Lists the metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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. + */ + listWithHttpOperationResponse(resourceUri, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceUri, 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 metric values for a resource**. + * + * @param {string} resourceUri The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.timespan] The timespan of the query. It is a string + * with the following format 'startDateTime_ISO/endDateTime_ISO'. + * + * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of + * the query. + * + * @param {string} [options.metricnames] The names of the metrics (comma + * separated) to retrieve. + * + * @param {string} [options.aggregation] The list of aggregation types (comma + * separated) to retrieve. + * + * @param {number} [options.top] The maximum number of records to retrieve. + * Valid only if $filter is specified. + * Defaults to 10. + * + * @param {string} [options.orderby] The aggregation to use for sorting results + * and the direction of the sort. + * Only one order can be specified. + * Examples: sum asc. + * + * @param {string} [options.filter] The **$filter** is used to reduce the set + * of metric data returned.
Example:
Metric contains metadata A, B and + * C.
- Return all time series of C where A = a1 and B = b1 or + * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- + * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = + * ‘b2’**
This is invalid because the logical or operator cannot separate + * two different metadata names.
- Return all time series where A = a1, B = + * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- + * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and + * C eq ‘*’**. + * + * @param {string} [options.resultType] Reduces the set of data collected. The + * syntax allowed depends on the operation. See the operation's description for + * details. Possible values include: 'Data', 'Metadata' + * + * @param {string} [options.metricnamespace] Metric namespace to query metric + * definitions for. + * + * @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 {Response} - 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 Response} 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. + */ + list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceUri, options, optionalCallback); + } + } + +} + +module.exports = Metrics; diff --git a/lib/services/monitor/lib/lib/operations/operations.js b/lib/services/monitor/lib/lib/operations/operations.js new file mode 100644 index 0000000000..664c03afa7 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/operations.js @@ -0,0 +1,235 @@ +/* + * 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; + +/** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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 OperationListResult} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/operations'; + 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['OperationListResult']().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 Operations. */ +class Operations { + /** + * Create a Operations. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @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 {OperationListResult} - 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 OperationListResult} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js b/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js new file mode 100644 index 0000000000..7e523153c9 --- /dev/null +++ b/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js @@ -0,0 +1,565 @@ +/* + * 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; + +/** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; + let apiVersion = '2015-04-01'; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { + throw new Error('select 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('/') ? '' : '/') + 'providers/microsoft.insights/eventtypes/management/values'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (select !== null && select !== undefined) { + queryParameters.push('$select=' + encodeURIComponent(select)); + } + 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['EventDataCollection']().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); + }); +} + +/** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 TenantActivityLogs. */ +class TenantActivityLogs { + /** + * Create a TenantActivityLogs. + * @param {MonitorManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Reduces the set of data collected.
The + * **$filter** is very restricted and allows only the following patterns.
- + * List events for a resource group: $filter=eventTimestamp ge '' + * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' + * and resourceGroupName eq ''.
- List events for + * resource: $filter=eventTimestamp ge '' and eventTimestamp le + * '' and eventChannels eq 'Admin, Operation' and resourceUri eq + * ''.
- List events for a subscription: $filter=eventTimestamp + * ge '' and eventTimestamp le '' and eventChannels eq + * 'Admin, Operation'.
- List events for a resource provider: + * $filter=eventTimestamp ge '' and eventTimestamp le '' + * and eventChannels eq 'Admin, Operation' and resourceProvider eq + * ''.
- List events for a correlation Id: + * api-version=2014-04-01&$filter=eventTimestamp ge + * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le + * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and + * correlationId eq ''.
**NOTE**: No other syntax is allowed. + * + * @param {string} [options.select] Used to fetch events with only the given + * properties.
The **$select** argument is a comma separated list of + * property names to be returned. Possible values are: *authorization*, + * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, + * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, + * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, + * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the Activity Logs for the Tenant.
Everything that is applicable to + * the API to get the Activity Logs for the subscription is applicable to this + * API (the parameters, $filter, etc.).
One thing to point out here is that + * this API does *not* retrieve the logs at the individual subscription of the + * tenant but only surfaces the logs that were generated at the tenant level. + * + * @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 {EventDataCollection} - 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 EventDataCollection} 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. + */ + listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = TenantActivityLogs; diff --git a/lib/services/monitor/lib/package.json b/lib/services/monitor/lib/package.json new file mode 100644 index 0000000000..7a880c0fcf --- /dev/null +++ b/lib/services/monitor/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-monitor", + "author": "Microsoft Corporation", + "description": "MonitorManagementClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/monitorManagementClient.js", + "types": "./lib/monitorManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +} From 287ed9fd7522e0536cfa1608282255f90997491f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 10:37:35 -0700 Subject: [PATCH 04/14] Generated from 992c89b743e8428fad25d981499b32665cfffc1c (#2613) merge from upstream --- .../monitor/lib/lib/operations/metricAlerts.js | 12 ++++++------ .../monitor/lib/lib/operations/metricAlertsStatus.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/services/monitor/lib/lib/operations/metricAlerts.js b/lib/services/monitor/lib/lib/operations/metricAlerts.js index d8cdf644dc..a08ce456ba 100644 --- a/lib/services/monitor/lib/lib/operations/metricAlerts.js +++ b/lib/services/monitor/lib/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)); @@ -522,7 +522,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)); @@ -713,7 +713,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 +870,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)); diff --git a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js index 7bd81a8494..29b4afc056 100644 --- a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js +++ b/lib/services/monitor/lib/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)); From 38be2bcb776ed38827a984b584ddd0b82bb0f84e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 5 Apr 2018 12:21:06 -0700 Subject: [PATCH 05/14] Generated from 18015d33322270e3572da438b7548e1f8bc109fc (#2681) Add extra description for Subscribe API --- lib/services/monitorManagement/LICENSE.txt | 42 +++++----- lib/services/monitorManagement/README.md | 77 ++++++++++--------- .../lib/operations/actionGroups.js | 9 ++- .../lib/operations/index.d.ts | 6 +- .../lib/operations/metricAlerts.js | 12 +-- .../lib/operations/metricAlertsStatus.js | 4 +- lib/services/monitorManagement/package.json | 4 +- 7 files changed, 82 insertions(+), 72 deletions(-) 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/operations/actionGroups.js b/lib/services/monitorManagement/lib/operations/actionGroups.js index 5c41c3e997..eb71ef49e3 100644 --- a/lib/services/monitorManagement/lib/operations/actionGroups.js +++ b/lib/services/monitorManagement/lib/operations/actionGroups.js @@ -945,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. * @@ -1716,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. * @@ -1751,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/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index f6c6bd1a66..e27f7c32ab 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -2349,7 +2349,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. * @@ -2372,7 +2373,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. * diff --git a/lib/services/monitorManagement/lib/operations/metricAlerts.js b/lib/services/monitorManagement/lib/operations/metricAlerts.js index d8cdf644dc..a08ce456ba 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)); @@ -522,7 +522,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)); @@ -713,7 +713,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 +870,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)); 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/package.json b/lib/services/monitorManagement/package.json index 936bbdcc65..9de3a86d66 100644 --- a/lib/services/monitorManagement/package.json +++ b/lib/services/monitorManagement/package.json @@ -2,9 +2,9 @@ "name": "azure-arm-monitor", "author": "Microsoft Corporation", "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "2.1.0-preview", + "version": "2.0.0-preview", "dependencies": { - "ms-rest": "^2.3.3", + "ms-rest": "^2.3.2", "ms-rest-azure": "^2.5.5" }, "keywords": [ "node", "azure" ], From 5e87a3992abc7f9f8f4e15b3b5274579f773fa09 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 9 Apr 2018 17:33:45 -0700 Subject: [PATCH 06/14] Generated from 0268cf352507751ebb32f8792fe1b1ede5aea85d (#2711) fix documentation bug: max length of Group Short Name should be 12 --- .../monitorManagement/lib/models/actionGroupResource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/monitorManagement/lib/models/actionGroupResource.js b/lib/services/monitorManagement/lib/models/actionGroupResource.js index 9a443885a8..f69df88ef8 100644 --- a/lib/services/monitorManagement/lib/models/actionGroupResource.js +++ b/lib/services/monitorManagement/lib/models/actionGroupResource.js @@ -111,7 +111,7 @@ class ActionGroupResource extends models['Resource'] { required: true, serializedName: 'properties.groupShortName', constraints: { - MaxLength: 15 + MaxLength: 12 }, type: { name: 'String' From d8644591aa437b677eea260f13f4755cc091e3e1 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 24 Apr 2018 10:53:23 -0700 Subject: [PATCH 07/14] [AutoPR monitor/resource-manager] Added GA API version for Scheduled Query Rule (#2721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Generated from 2e4c790d16eb6be9299db7a75798bca1697fd5e9 Added GA API version for Scheduled Query Rule Added GA API version for Scheduled Query Rule * Generated from d183bad923d3a0a4092d21203f850db6cde9f4e9 Resolving Comments Resolving Comments * Generated from df40ac3bbf17ea0180dd4adff2af3094065feca0 Made SKU as top level proprty and including generic error response format Couple of changes - 1. Made SKU as top level proprty as mentioned here - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#put-resource 2. including generic error response format * Generated from 7578160670750a68d05f77ec8163b25bb72f391e Minor Changes to align implementation 1. Removed SKU - Billing Model is still under discussion, hence need not to be exposed to customers. 2. Enabled field ichanged to align with camel case. 3. 'throttleTillDate' in properties.action changed to 'throttlingInMin' to denote correct meaning and it’s data type changed to number instead of date. 4. 'status' to be removed in properties.action from examples. 5. 'severity' made a required field in properties.action. 6. Removed Examples from original spec json * Generated from fb180fb311d73934d0f5150f72638cc3de155ea0 Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear * Generated from fb180fb311d73934d0f5150f72638cc3de155ea0 Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear --- .../monitorManagement/lib/models/action.js | 14 + .../lib/models/actionGroupResource.js | 2 +- .../lib/models/alertingAction.js | 163 ++ .../lib/models/azNsActionGroup.js | 76 + .../monitorManagement/lib/models/index.d.ts | 243 +++ .../monitorManagement/lib/models/index.js | 11 +- .../lib/models/logSearchRuleResource.js | 180 +++ .../models/logSearchRuleResourceCollection.js | 59 + .../lib/models/metricAlertResource.js | 5 + .../lib/models/metricAlertResourcePatch.js | 5 + .../lib/models/metricTrigger.js | 28 + .../monitorManagement/lib/models/scaleRule.js | 7 + .../monitorManagement/lib/models/schedule.js | 63 + .../monitorManagement/lib/models/sku1.js | 53 + .../monitorManagement/lib/models/source.js | 87 ++ .../lib/models/triggerCondition.js | 106 ++ .../lib/monitorManagementClient.d.ts | 1 + .../lib/monitorManagementClient.js | 1 + .../lib/operations/index.d.ts | 405 +++++ .../monitorManagement/lib/operations/index.js | 1 + .../lib/operations/scheduledQueryRules.js | 1355 +++++++++++++++++ 21 files changed, 2863 insertions(+), 2 deletions(-) create mode 100644 lib/services/monitorManagement/lib/models/alertingAction.js create mode 100644 lib/services/monitorManagement/lib/models/azNsActionGroup.js create mode 100644 lib/services/monitorManagement/lib/models/logSearchRuleResource.js create mode 100644 lib/services/monitorManagement/lib/models/logSearchRuleResourceCollection.js create mode 100644 lib/services/monitorManagement/lib/models/schedule.js create mode 100644 lib/services/monitorManagement/lib/models/sku1.js create mode 100644 lib/services/monitorManagement/lib/models/source.js create mode 100644 lib/services/monitorManagement/lib/models/triggerCondition.js create mode 100644 lib/services/monitorManagement/lib/operations/scheduledQueryRules.js diff --git a/lib/services/monitorManagement/lib/models/action.js b/lib/services/monitorManagement/lib/models/action.js index 91eaf1b94d..e5f19a803c 100644 --- a/lib/services/monitorManagement/lib/models/action.js +++ b/lib/services/monitorManagement/lib/models/action.js @@ -19,6 +19,7 @@ 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,6 +36,11 @@ class Action { serializedName: 'Action', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', className: 'Action', modelProperties: { actionGroupId: { @@ -57,6 +63,14 @@ class Action { } } } + }, + odatatype: { + required: true, + serializedName: 'odata\\.type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } } } } diff --git a/lib/services/monitorManagement/lib/models/actionGroupResource.js b/lib/services/monitorManagement/lib/models/actionGroupResource.js index f69df88ef8..9a443885a8 100644 --- a/lib/services/monitorManagement/lib/models/actionGroupResource.js +++ b/lib/services/monitorManagement/lib/models/actionGroupResource.js @@ -111,7 +111,7 @@ class ActionGroupResource extends models['Resource'] { required: true, serializedName: 'properties.groupShortName', constraints: { - MaxLength: 12 + MaxLength: 15 }, type: { name: 'String' diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js new file mode 100644 index 0000000000..467e671bba --- /dev/null +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -0,0 +1,163 @@ +/* + * 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 azns notification group reference. + * @member {array} [aznsAction.actionGroup] Azure Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject for Azns email + * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload + * to be send to azns action group + * @member {number} [throttlingInMin] time (in minutes) for which Alerts + * should be throttled + * @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.metricName] the name of the metric + * that defines what the rule monitors. + * @member {string} [trigger.metricTrigger.metricResourceUri] the resource + * identifier of the resource the rule monitors. + * @member {moment.duration} [trigger.metricTrigger.timeGrain] the + * granularity of metrics the rule monitors. Must be one of the predefined + * values returned from metric definitions for the metric. Must be between 12 + * hours and 1 minute. + * @member {string} [trigger.metricTrigger.statistic] the metric statistic + * type. How the metrics from multiple instances are combined. Possible + * values include: 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [trigger.metricTrigger.timeWindow] the range of + * time in which instance data is collected. This value must be greater than + * the delay in metric collection, which can vary from resource-to-resource. + * Must be between 12 hours and 5 minutes. + * @member {string} [trigger.metricTrigger.timeAggregation] time aggregation + * type. How the data that is collected should be combined over time. The + * default value is Average. Possible values include: 'Average', 'Minimum', + * 'Maximum', 'Total', 'Count' + * @member {string} [trigger.metricTrigger.operator] the operator that is + * used to compare the metric data and the threshold. Possible values + * include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', + * 'LessThan', 'LessThanOrEqual' + * @member {number} [trigger.metricTrigger.threshold] the threshold of the + * metric that triggers the scale action. + * @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation + * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible + * values include: 'GreaterThan', 'LessThan', 'Equal' + * @member {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: { + actionGroupId: { + required: false, + serializedName: 'actionGroupId', + type: { + name: 'String' + } + }, + webhookProperties: { + required: false, + serializedName: 'webhookProperties', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + 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/azNsActionGroup.js b/lib/services/monitorManagement/lib/models/azNsActionGroup.js new file mode 100644 index 0000000000..6a8177b293 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/azNsActionGroup.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * azns notification group + * + */ +class AzNsActionGroup { + /** + * Create a AzNsActionGroup. + * @member {array} [actionGroup] Azure Group reference. + * @member {string} [emailSubject] Custom subject for Azns email + * @member {string} [customWebhookPayload] Custom webhook payload to be send + * to azns action group + */ + 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/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index 44807752fe..7daa282894 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -84,6 +84,12 @@ export interface ScaleCapacity { * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' * @member {number} threshold the threshold of the metric that triggers the * scale action. + * @member {string} [thresholdOperator] Evaluation operation for Metric + * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' or + * 'Total'. Possible values include: 'Consecutive', 'Total' + * @member {string} [metricColumn] Evaluation of metric on a particular column */ export interface MetricTrigger { metricName: string; @@ -94,6 +100,9 @@ export interface MetricTrigger { timeAggregation: string; operator: string; threshold: number; + thresholdOperator?: string; + metricTriggerType?: string; + metricColumn?: string; } /** @@ -154,6 +163,13 @@ export interface ScaleAction { * 'LessThanOrEqual' * @member {number} [metricTrigger.threshold] the threshold of the metric that * triggers the scale action. + * @member {string} [metricTrigger.thresholdOperator] Evaluation operation for + * Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type - + * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' + * @member {string} [metricTrigger.metricColumn] Evaluation of metric on a + * particular column * @member {object} scaleAction the parameters for the scaling action. * @member {string} [scaleAction.direction] the scale direction. Whether the * scaling action increases or decreases the number of instances. Possible @@ -1984,10 +2000,12 @@ export interface CalculateBaselineResponse { * * @member {string} [actionGroupId] the id of the action group to use. * @member {object} [webhookProperties] + * @member {string} odatatype Polymorphic Discriminator */ export interface Action { actionGroupId?: string; webhookProperties?: { [propertyName: string]: string }; + odatatype: string; } /** @@ -2184,6 +2202,221 @@ 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 if query should be + * returning search result count. Set it to Number if its a metric query. + * 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 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 if query should + * be returning search result count. Set it to Number if its a metric query. + * 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.actionGroupId] the id of the action group to use. + * @member {object} [action.webhookProperties] + * @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 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.metricName] the name of the metric that + * defines what the rule monitors. + * @member {string} [metricTrigger.metricResourceUri] the resource identifier + * of the resource the rule monitors. + * @member {moment.duration} [metricTrigger.timeGrain] the granularity of + * metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [metricTrigger.statistic] the metric statistic type. How + * the metrics from multiple instances are combined. Possible values include: + * 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [metricTrigger.timeWindow] the range of time in + * which instance data is collected. This value must be greater than the delay + * in metric collection, which can vary from resource-to-resource. Must be + * between 12 hours and 5 minutes. + * @member {string} [metricTrigger.timeAggregation] time aggregation type. How + * the data that is collected should be combined over time. The default value + * is Average. Possible values include: 'Average', 'Minimum', 'Maximum', + * 'Total', 'Count' + * @member {string} [metricTrigger.operator] the operator that is used to + * compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [metricTrigger.threshold] the threshold of the metric that + * triggers the scale action. + * @member {string} [metricTrigger.thresholdOperator] Evaluation operation for + * Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {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?: MetricTrigger; +} + +/** + * @class + * Initializes a new instance of the AzNsActionGroup class. + * @constructor + * azns notification group + * + * @member {array} [actionGroup] Azure Group reference. + * @member {string} [emailSubject] Custom subject for Azns email + * @member {string} [customWebhookPayload] Custom webhook payload to be send to + * azns action group + */ +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 azns notification group reference. + * @member {array} [aznsAction.actionGroup] Azure Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject for Azns email + * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload to + * be send to azns action group + * @member {number} [throttlingInMin] time (in minutes) for which Alerts should + * be throttled + * @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.metricName] the name of the metric + * that defines what the rule monitors. + * @member {string} [trigger.metricTrigger.metricResourceUri] the resource + * identifier of the resource the rule monitors. + * @member {moment.duration} [trigger.metricTrigger.timeGrain] the granularity + * of metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [trigger.metricTrigger.statistic] the metric statistic + * type. How the metrics from multiple instances are combined. Possible values + * include: 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [trigger.metricTrigger.timeWindow] the range of + * time in which instance data is collected. This value must be greater than + * the delay in metric collection, which can vary from resource-to-resource. + * Must be between 12 hours and 5 minutes. + * @member {string} [trigger.metricTrigger.timeAggregation] time aggregation + * type. How the data that is collected should be combined over time. The + * default value is Average. Possible values include: 'Average', 'Minimum', + * 'Maximum', 'Total', 'Count' + * @member {string} [trigger.metricTrigger.operator] the operator that is used + * to compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [trigger.metricTrigger.threshold] the threshold of the + * metric that triggers the scale action. + * @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation + * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible + * values include: 'GreaterThan', 'LessThan', 'Equal' + * @member {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 @@ -2296,3 +2529,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 878adabbd3..b863800b50 100644 --- a/lib/services/monitorManagement/lib/models/index.js +++ b/lib/services/monitorManagement/lib/models/index.js @@ -105,6 +105,12 @@ 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.LogSearchRuleResource = require('./logSearchRuleResource'); +exports.TriggerCondition = require('./triggerCondition'); +exports.AzNsActionGroup = require('./azNsActionGroup'); +exports.AlertingAction = require('./alertingAction'); exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); exports.IncidentListResult = require('./incidentListResult'); exports.AlertRuleResourceCollection = require('./alertRuleResourceCollection'); @@ -115,6 +121,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, @@ -126,6 +133,8 @@ exports.discriminators = { 'RuleAction' : exports.RuleAction, 'RuleAction.Microsoft.Azure.Management.Insights.Models.RuleEmailAction' : exports.RuleEmailAction, 'RuleAction.Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' : exports.RuleWebhookAction, + 'Action' : exports.Action, 'MetricAlertCriteria' : exports.MetricAlertCriteria, - 'MetricAlertCriteria.Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' : exports.MetricAlertSingleResourceMultipleMetricCriteria + 'MetricAlertCriteria.Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' : exports.MetricAlertSingleResourceMultipleMetricCriteria, + 'Action.Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' : exports.AlertingAction }; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js new file mode 100644 index 0000000000..d791a93e32 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -0,0 +1,180 @@ +/* + * 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 if query + * should be returning search result count. Set it to Number if its a metric + * query. 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.actionGroupId] the id of the action group to use. + * @member {object} [action.webhookProperties] + * @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/metricAlertResource.js b/lib/services/monitorManagement/lib/models/metricAlertResource.js index c21174220c..91a31fa6dd 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertResource.js +++ b/lib/services/monitorManagement/lib/models/metricAlertResource.js @@ -186,6 +186,11 @@ class MetricAlertResource extends models['Resource'] { serializedName: 'ActionElementType', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', className: 'Action' } } diff --git a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js index 1832373f2d..452a6bf1b2 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js +++ b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js @@ -154,6 +154,11 @@ class MetricAlertResourcePatch { serializedName: 'ActionElementType', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'odata.type', + clientName: 'odatatype' + }, + uberParent: 'Action', className: 'Action' } } diff --git a/lib/services/monitorManagement/lib/models/metricTrigger.js b/lib/services/monitorManagement/lib/models/metricTrigger.js index 09e76603e5..3591915bf6 100644 --- a/lib/services/monitorManagement/lib/models/metricTrigger.js +++ b/lib/services/monitorManagement/lib/models/metricTrigger.js @@ -39,6 +39,13 @@ class MetricTrigger { * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' * @member {number} threshold the threshold of the metric that triggers the * scale action. + * @member {string} [thresholdOperator] Evaluation operation for Metric + * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' + * or 'Total'. Possible values include: 'Consecutive', 'Total' + * @member {string} [metricColumn] Evaluation of metric on a particular + * column */ constructor() { } @@ -115,6 +122,27 @@ class MetricTrigger { type: { name: 'Number' } + }, + thresholdOperator: { + required: false, + serializedName: 'thresholdOperator', + type: { + name: 'String' + } + }, + metricTriggerType: { + required: false, + serializedName: 'metricTriggerType', + type: { + name: 'String' + } + }, + metricColumn: { + required: false, + serializedName: 'metricColumn', + type: { + name: 'String' + } } } } diff --git a/lib/services/monitorManagement/lib/models/scaleRule.js b/lib/services/monitorManagement/lib/models/scaleRule.js index 0836d498c2..3114436dd0 100644 --- a/lib/services/monitorManagement/lib/models/scaleRule.js +++ b/lib/services/monitorManagement/lib/models/scaleRule.js @@ -46,6 +46,13 @@ class ScaleRule { * 'LessThanOrEqual' * @member {number} [metricTrigger.threshold] the threshold of the metric * that triggers the scale action. + * @member {string} [metricTrigger.thresholdOperator] Evaluation operation + * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values + * include: 'GreaterThan', 'LessThan', 'Equal' + * @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type - + * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' + * @member {string} [metricTrigger.metricColumn] Evaluation of metric on a + * particular column * @member {object} scaleAction the parameters for the scaling action. * @member {string} [scaleAction.direction] the scale direction. Whether the * scaling action increases or decreases the number of instances. Possible 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..21f7bc859f --- /dev/null +++ b/lib/services/monitorManagement/lib/models/source.js @@ -0,0 +1,87 @@ +/* + * 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 if query should be + * returning search result count. Set it to Number if its a metric query. + * 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..2db331d533 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/triggerCondition.js @@ -0,0 +1,106 @@ +/* + * 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.metricName] the name of the metric that + * defines what the rule monitors. + * @member {string} [metricTrigger.metricResourceUri] the resource identifier + * of the resource the rule monitors. + * @member {moment.duration} [metricTrigger.timeGrain] the granularity of + * metrics the rule monitors. Must be one of the predefined values returned + * from metric definitions for the metric. Must be between 12 hours and 1 + * minute. + * @member {string} [metricTrigger.statistic] the metric statistic type. How + * the metrics from multiple instances are combined. Possible values include: + * 'Average', 'Min', 'Max', 'Sum' + * @member {moment.duration} [metricTrigger.timeWindow] the range of time in + * which instance data is collected. This value must be greater than the + * delay in metric collection, which can vary from resource-to-resource. Must + * be between 12 hours and 5 minutes. + * @member {string} [metricTrigger.timeAggregation] time aggregation type. + * How the data that is collected should be combined over time. The default + * value is Average. Possible values include: 'Average', 'Minimum', + * 'Maximum', 'Total', 'Count' + * @member {string} [metricTrigger.operator] the operator that is used to + * compare the metric data and the threshold. Possible values include: + * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual' + * @member {number} [metricTrigger.threshold] the threshold of the metric + * that triggers the scale action. + * @member {string} [metricTrigger.thresholdOperator] Evaluation operation + * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values + * include: 'GreaterThan', 'LessThan', 'Equal' + * @member {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: 'MetricTrigger' + } + } + } + } + }; + } +} + +module.exports = TriggerCondition; diff --git a/lib/services/monitorManagement/lib/monitorManagementClient.d.ts b/lib/services/monitorManagement/lib/monitorManagementClient.d.ts index 9c64e133dc..23e746ef1e 100644 --- a/lib/services/monitorManagement/lib/monitorManagementClient.d.ts +++ b/lib/services/monitorManagement/lib/monitorManagementClient.d.ts @@ -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..7d0d15edd2 100644 --- a/lib/services/monitorManagement/lib/monitorManagementClient.js +++ b/lib/services/monitorManagement/lib/monitorManagementClient.js @@ -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/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index e27f7c32ab..36e4ac1333 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -4284,3 +4284,408 @@ 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 if + * query should be returning search result count. Set it to Number if its a + * metric query. 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.actionGroupId] the id of the action group + * to use. + * + * @param {object} [parameters.action.webhookProperties] + * + * @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 if + * query should be returning search result count. Set it to Number if its a + * metric query. 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.actionGroupId] the id of the action group + * to use. + * + * @param {object} [parameters.action.webhookProperties] + * + * @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; + + + /** + * 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/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js new file mode 100644 index 0000000000..fc6215f9d0 --- /dev/null +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -0,0 +1,1355 @@ +/* + * 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 if + * query should be returning search result count. Set it to Number if its a + * metric query. 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.actionGroupId] the id of the action group + * to use. + * + * @param {object} [parameters.action.webhookProperties] + * + * @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); + }); +} + +/** + * 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._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 if + * query should be returning search result count. Set it to Number if its a + * metric query. 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.actionGroupId] the id of the action group + * to use. + * + * @param {object} [parameters.action.webhookProperties] + * + * @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 if + * query should be returning search result count. Set it to Number if its a + * metric query. 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.actionGroupId] the id of the action group + * to use. + * + * @param {object} [parameters.action.webhookProperties] + * + * @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); + } + } + + /** + * 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; From 4d59ea56c74cd45b34d276e62c3433d275d05c11 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 3 May 2018 08:33:30 -0700 Subject: [PATCH 08/14] [AutoPR monitor/resource-manager] Minor Updates - description text (#2824) * Generated from 0c826790271a1be2d4af5905ee0eb089b4260feb Merge pull request #1 from abversqr/MinorUpdates Minor updates * Generated from 1610a74a5c49c73a546972daca1e7a43798a8cea Merge branch 'master' into master --- .../lib/models/actionGroupResource.js | 2 +- .../lib/models/alertingAction.js | 13 ++++---- .../lib/models/azNsActionGroup.js | 11 +++---- .../monitorManagement/lib/models/index.d.ts | 30 ++++++++++--------- .../lib/models/logSearchRuleResource.js | 2 +- .../monitorManagement/lib/models/source.js | 6 ++-- .../lib/operations/index.d.ts | 4 +-- .../lib/operations/scheduledQueryRules.js | 6 ++-- 8 files changed, 39 insertions(+), 35 deletions(-) diff --git a/lib/services/monitorManagement/lib/models/actionGroupResource.js b/lib/services/monitorManagement/lib/models/actionGroupResource.js index 9a443885a8..f69df88ef8 100644 --- a/lib/services/monitorManagement/lib/models/actionGroupResource.js +++ b/lib/services/monitorManagement/lib/models/actionGroupResource.js @@ -111,7 +111,7 @@ class ActionGroupResource extends models['Resource'] { required: true, serializedName: 'properties.groupShortName', constraints: { - MaxLength: 15 + MaxLength: 12 }, type: { name: 'String' diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js index 467e671bba..b039c1473e 100644 --- a/lib/services/monitorManagement/lib/models/alertingAction.js +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -22,13 +22,14 @@ class AlertingAction extends models['Action'] { * Create a AlertingAction. * @member {string} severity Severity of the alert. Possible values include: * '0', '1', '2', '3', '4' - * @member {object} aznsAction azns notification group reference. - * @member {array} [aznsAction.actionGroup] Azure Group reference. - * @member {string} [aznsAction.emailSubject] Custom subject for Azns email - * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload - * to be send to azns action group + * @member {object} aznsAction Azure action group reference. + * @member {array} [aznsAction.actionGroup] Azure Action Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject override for all + * email ids in Azure action group + * @member {string} [aznsAction.customWebhookPayload] Custom payload to be + * sent for all webook URI in Azure action group * @member {number} [throttlingInMin] time (in minutes) for which Alerts - * should be throttled + * should be throttled or suppressed. * @member {object} trigger The trigger condition that results in the alert * rule being. * @member {string} [trigger.thresholdOperator] Evaluation operation for rule diff --git a/lib/services/monitorManagement/lib/models/azNsActionGroup.js b/lib/services/monitorManagement/lib/models/azNsActionGroup.js index 6a8177b293..c3d0dea8ee 100644 --- a/lib/services/monitorManagement/lib/models/azNsActionGroup.js +++ b/lib/services/monitorManagement/lib/models/azNsActionGroup.js @@ -11,16 +11,17 @@ 'use strict'; /** - * azns notification group + * Azure action group * */ class AzNsActionGroup { /** * Create a AzNsActionGroup. - * @member {array} [actionGroup] Azure Group reference. - * @member {string} [emailSubject] Custom subject for Azns email - * @member {string} [customWebhookPayload] Custom webhook payload to be send - * to azns action group + * @member {array} [actionGroup] Azure Action Group reference. + * @member {string} [emailSubject] Custom subject override for all email ids + * in Azure action group + * @member {string} [customWebhookPayload] Custom payload to be sent for all + * webook URI in Azure action group */ constructor() { } diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index 7daa282894..26f2f47d43 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -2210,7 +2210,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA * * @member {string} query Log search query. * @member {array} [authorizedResources] List of Resource referred into query - * @member {string} datasourceId The resource uri over which log search query + * @member {string} dataSourceId The resource uri over which log search query * is to be run. * @member {string} [queryType] Set value to ResultCount if query should be * returning search result count. Set it to Number if its a metric query. @@ -2219,7 +2219,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA export interface Source { query: string; authorizedResources?: string[]; - datasourceId: string; + dataSourceId: string; queryType?: string; } @@ -2258,7 +2258,7 @@ export interface Schedule { * @member {string} [source.query] Log search query. * @member {array} [source.authorizedResources] List of Resource referred into * query - * @member {string} [source.datasourceId] The resource uri over which log + * @member {string} [source.dataSourceId] The resource uri over which log * search query is to be run. * @member {string} [source.queryType] Set value to ResultCount if query should * be returning search result count. Set it to Number if its a metric query. @@ -2339,12 +2339,13 @@ export interface TriggerCondition { * @class * Initializes a new instance of the AzNsActionGroup class. * @constructor - * azns notification group + * Azure action group * - * @member {array} [actionGroup] Azure Group reference. - * @member {string} [emailSubject] Custom subject for Azns email - * @member {string} [customWebhookPayload] Custom webhook payload to be send to - * azns action group + * @member {array} [actionGroup] Azure Action Group reference. + * @member {string} [emailSubject] Custom subject override for all email ids in + * Azure action group + * @member {string} [customWebhookPayload] Custom payload to be sent for all + * webook URI in Azure action group */ export interface AzNsActionGroup { actionGroup?: string[]; @@ -2360,13 +2361,14 @@ export interface AzNsActionGroup { * * @member {string} severity Severity of the alert. Possible values include: * '0', '1', '2', '3', '4' - * @member {object} aznsAction azns notification group reference. - * @member {array} [aznsAction.actionGroup] Azure Group reference. - * @member {string} [aznsAction.emailSubject] Custom subject for Azns email - * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload to - * be send to azns action group + * @member {object} aznsAction Azure action group reference. + * @member {array} [aznsAction.actionGroup] Azure Action Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject override for all + * email ids in Azure action group + * @member {string} [aznsAction.customWebhookPayload] Custom payload to be sent + * for all webook URI in Azure action group * @member {number} [throttlingInMin] time (in minutes) for which Alerts should - * be throttled + * be throttled or suppressed. * @member {object} trigger The trigger condition that results in the alert * rule being. * @member {string} [trigger.thresholdOperator] Evaluation operation for rule - diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js index d791a93e32..e597e5a5f0 100644 --- a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -33,7 +33,7 @@ class LogSearchRuleResource extends models['Resource'] { * @member {string} [source.query] Log search query. * @member {array} [source.authorizedResources] List of Resource referred * into query - * @member {string} [source.datasourceId] The resource uri over which log + * @member {string} [source.dataSourceId] The resource uri over which log * search query is to be run. * @member {string} [source.queryType] Set value to ResultCount if query * should be returning search result count. Set it to Number if its a metric diff --git a/lib/services/monitorManagement/lib/models/source.js b/lib/services/monitorManagement/lib/models/source.js index 21f7bc859f..117d39a951 100644 --- a/lib/services/monitorManagement/lib/models/source.js +++ b/lib/services/monitorManagement/lib/models/source.js @@ -20,7 +20,7 @@ class 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 + * @member {string} dataSourceId The resource uri over which log search query * is to be run. * @member {string} [queryType] Set value to ResultCount if query should be * returning search result count. Set it to Number if its a metric query. @@ -64,9 +64,9 @@ class Source { } } }, - datasourceId: { + dataSourceId: { required: true, - serializedName: 'datasourceId', + serializedName: 'dataSourceId', type: { name: 'String' } diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index 36e4ac1333..c1eea8380a 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -4318,7 +4318,7 @@ export interface ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -4386,7 +4386,7 @@ export interface ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if diff --git a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js index fc6215f9d0..112a3ba13c 100644 --- a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -38,7 +38,7 @@ const WebResource = msRest.WebResource; * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -843,7 +843,7 @@ class ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -923,7 +923,7 @@ class ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if From 635f60b34f05371d38c11e30dc093d38d1139ed4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 21 May 2018 08:57:17 -0700 Subject: [PATCH 09/14] [AutoPR monitor/resource-manager] Add "autoMitigate" to Metric Alert API spec for 2018-03-01 (#2884) * Generated from d5b9b4545a8d15c70d3c8318d39e2f7b43229387 AutoMitigate changes * Generated from d5b9b4545a8d15c70d3c8318d39e2f7b43229387 AutoMitigate changes --- .../lib/models/alertingAction.js | 13 ++++--- .../lib/models/azNsActionGroup.js | 11 +++--- .../monitorManagement/lib/models/index.d.ts | 36 ++++++++++--------- .../lib/models/logSearchRuleResource.js | 2 +- .../lib/models/metricAlertResource.js | 9 +++++ .../lib/models/metricAlertResourcePatch.js | 9 +++++ .../monitorManagement/lib/models/source.js | 6 ++-- .../lib/operations/index.d.ts | 16 +++++++-- .../lib/operations/metricAlerts.js | 18 ++++++++++ .../lib/operations/scheduledQueryRules.js | 6 ++-- lib/services/monitorManagement/package.json | 7 ++-- 11 files changed, 93 insertions(+), 40 deletions(-) diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js index b039c1473e..467e671bba 100644 --- a/lib/services/monitorManagement/lib/models/alertingAction.js +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -22,14 +22,13 @@ 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 {object} aznsAction azns notification group reference. + * @member {array} [aznsAction.actionGroup] Azure Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject for Azns email + * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload + * to be send to azns action group * @member {number} [throttlingInMin] time (in minutes) for which Alerts - * should be throttled or suppressed. + * should be throttled * @member {object} trigger The trigger condition that results in the alert * rule being. * @member {string} [trigger.thresholdOperator] Evaluation operation for rule diff --git a/lib/services/monitorManagement/lib/models/azNsActionGroup.js b/lib/services/monitorManagement/lib/models/azNsActionGroup.js index c3d0dea8ee..6a8177b293 100644 --- a/lib/services/monitorManagement/lib/models/azNsActionGroup.js +++ b/lib/services/monitorManagement/lib/models/azNsActionGroup.js @@ -11,17 +11,16 @@ 'use strict'; /** - * Azure action group + * azns notification 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 + * @member {array} [actionGroup] Azure Group reference. + * @member {string} [emailSubject] Custom subject for Azns email + * @member {string} [customWebhookPayload] Custom webhook payload to be send + * to azns action group */ constructor() { } diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index 26f2f47d43..fe85bf4a97 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -2045,6 +2045,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 @@ -2058,6 +2060,7 @@ export interface MetricAlertResource extends Resource { evaluationFrequency: moment.Duration; windowSize: moment.Duration; criteria: MetricAlertCriteria; + autoMitigate?: boolean; actions?: Action[]; readonly lastUpdatedTime?: Date; } @@ -2083,6 +2086,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 @@ -2097,6 +2102,7 @@ export interface MetricAlertResourcePatch { evaluationFrequency: moment.Duration; windowSize: moment.Duration; criteria: MetricAlertCriteria; + autoMitigate?: boolean; actions?: Action[]; readonly lastUpdatedTime?: Date; } @@ -2210,7 +2216,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA * * @member {string} query Log search query. * @member {array} [authorizedResources] List of Resource referred into query - * @member {string} dataSourceId The resource uri over which log search query + * @member {string} datasourceId The resource uri over which log search query * is to be run. * @member {string} [queryType] Set value to ResultCount if query should be * returning search result count. Set it to Number if its a metric query. @@ -2219,7 +2225,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA export interface Source { query: string; authorizedResources?: string[]; - dataSourceId: string; + datasourceId: string; queryType?: string; } @@ -2258,7 +2264,7 @@ export interface Schedule { * @member {string} [source.query] Log search query. * @member {array} [source.authorizedResources] List of Resource referred into * query - * @member {string} [source.dataSourceId] The resource uri over which log + * @member {string} [source.datasourceId] The resource uri over which log * search query is to be run. * @member {string} [source.queryType] Set value to ResultCount if query should * be returning search result count. Set it to Number if its a metric query. @@ -2339,13 +2345,12 @@ export interface TriggerCondition { * @class * Initializes a new instance of the AzNsActionGroup class. * @constructor - * Azure action group + * azns notification 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 + * @member {array} [actionGroup] Azure Group reference. + * @member {string} [emailSubject] Custom subject for Azns email + * @member {string} [customWebhookPayload] Custom webhook payload to be send to + * azns action group */ export interface AzNsActionGroup { actionGroup?: string[]; @@ -2361,14 +2366,13 @@ export interface AzNsActionGroup { * * @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 {object} aznsAction azns notification group reference. + * @member {array} [aznsAction.actionGroup] Azure Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject for Azns email + * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload to + * be send to azns action group * @member {number} [throttlingInMin] time (in minutes) for which Alerts should - * be throttled or suppressed. + * be throttled * @member {object} trigger The trigger condition that results in the alert * rule being. * @member {string} [trigger.thresholdOperator] Evaluation operation for rule - diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js index e597e5a5f0..d791a93e32 100644 --- a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -33,7 +33,7 @@ class LogSearchRuleResource extends models['Resource'] { * @member {string} [source.query] Log search query. * @member {array} [source.authorizedResources] List of Resource referred * into query - * @member {string} [source.dataSourceId] The resource uri over which log + * @member {string} [source.datasourceId] The resource uri over which log * search query is to be run. * @member {string} [source.queryType] Set value to ResultCount if query * should be returning search result count. Set it to Number if its a metric diff --git a/lib/services/monitorManagement/lib/models/metricAlertResource.js b/lib/services/monitorManagement/lib/models/metricAlertResource.js index 91a31fa6dd..9b17b18760 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', diff --git a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js index 452a6bf1b2..2d5d6c286f 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', diff --git a/lib/services/monitorManagement/lib/models/source.js b/lib/services/monitorManagement/lib/models/source.js index 117d39a951..21f7bc859f 100644 --- a/lib/services/monitorManagement/lib/models/source.js +++ b/lib/services/monitorManagement/lib/models/source.js @@ -20,7 +20,7 @@ class 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 + * @member {string} datasourceId The resource uri over which log search query * is to be run. * @member {string} [queryType] Set value to ResultCount if query should be * returning search result count. Set it to Number if its a metric query. @@ -64,9 +64,9 @@ class Source { } } }, - dataSourceId: { + datasourceId: { required: true, - serializedName: 'dataSourceId', + serializedName: 'datasourceId', type: { name: 'String' } diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index c1eea8380a..69e78676ea 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -3884,6 +3884,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. * @@ -3936,6 +3939,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. * @@ -4009,6 +4015,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. * @@ -4059,6 +4068,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. * @@ -4318,7 +4330,7 @@ export interface ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.dataSourceId The resource uri over which + * @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 if @@ -4386,7 +4398,7 @@ export interface ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.dataSourceId The resource uri over which + * @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 if diff --git a/lib/services/monitorManagement/lib/operations/metricAlerts.js b/lib/services/monitorManagement/lib/operations/metricAlerts.js index a08ce456ba..ed52e2172a 100644 --- a/lib/services/monitorManagement/lib/operations/metricAlerts.js +++ b/lib/services/monitorManagement/lib/operations/metricAlerts.js @@ -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. * @@ -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. * @@ -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/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js index 112a3ba13c..fc6215f9d0 100644 --- a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -38,7 +38,7 @@ const WebResource = msRest.WebResource; * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.dataSourceId The resource uri over which + * @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 if @@ -843,7 +843,7 @@ class ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.dataSourceId The resource uri over which + * @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 if @@ -923,7 +923,7 @@ class ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.dataSourceId The resource uri over which + * @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 if diff --git a/lib/services/monitorManagement/package.json b/lib/services/monitorManagement/package.json index 9de3a86d66..c0e34cb212 100644 --- a/lib/services/monitorManagement/package.json +++ b/lib/services/monitorManagement/package.json @@ -4,10 +4,13 @@ "description": "MonitorManagementClient Library with typescript type definitions for node", "version": "2.0.0-preview", "dependencies": { - "ms-rest": "^2.3.2", + "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", From ba36e4badca399a547e124b4d102f4d1a447eddf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 24 May 2018 14:59:25 -0700 Subject: [PATCH 10/14] [AutoPR monitor/resource-manager] [Monitor] Deconflict "Action" name in MetricAlert (#2902) * Generated from 35adc5e493c20a57e6e2cb35d87c578133d2b7a6 [Monitor] Deconflict "Action" name in MetricAlert Generates bad SDK. * Generated from ebfaf0bdd7f2bcf736598d8ec501f490a83d1268 Update reference to MetricAlertAction --- .../monitorManagement/lib/models/action.js | 26 +------ .../lib/models/alertingAction.js | 34 ++-------- .../lib/models/azNsActionGroup.js | 11 +-- .../monitorManagement/lib/models/index.d.ts | 52 ++++++++------ .../monitorManagement/lib/models/index.js | 5 +- .../lib/models/logSearchRuleResource.js | 4 +- .../lib/models/metricAlertAction.js | 67 +++++++++++++++++++ .../lib/models/metricAlertResource.js | 9 +-- .../lib/models/metricAlertResourcePatch.js | 9 +-- .../monitorManagement/lib/models/source.js | 6 +- .../lib/operations/index.d.ts | 14 +--- .../lib/operations/scheduledQueryRules.js | 21 +----- 12 files changed, 127 insertions(+), 131 deletions(-) create mode 100644 lib/services/monitorManagement/lib/models/metricAlertAction.js diff --git a/lib/services/monitorManagement/lib/models/action.js b/lib/services/monitorManagement/lib/models/action.js index e5f19a803c..282636d503 100644 --- a/lib/services/monitorManagement/lib/models/action.js +++ b/lib/services/monitorManagement/lib/models/action.js @@ -11,14 +11,11 @@ 'use strict'; /** - * An alert action. - * + * Class representing a Action. */ 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() { @@ -43,27 +40,6 @@ class Action { uberParent: 'Action', className: 'Action', 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' - } - } - } - }, odatatype: { required: true, serializedName: 'odata\\.type', diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js index 467e671bba..7a23c3c73c 100644 --- a/lib/services/monitorManagement/lib/models/alertingAction.js +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -22,13 +22,14 @@ class AlertingAction extends models['Action'] { * Create a AlertingAction. * @member {string} severity Severity of the alert. Possible values include: * '0', '1', '2', '3', '4' - * @member {object} aznsAction azns notification group reference. - * @member {array} [aznsAction.actionGroup] Azure Group reference. - * @member {string} [aznsAction.emailSubject] Custom subject for Azns email - * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload - * to be send to azns action group + * @member {object} aznsAction Azure action group reference. + * @member {array} [aznsAction.actionGroup] Azure Action Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject override for all + * email ids in Azure action group + * @member {string} [aznsAction.customWebhookPayload] Custom payload to be + * sent for all webook URI in Azure action group * @member {number} [throttlingInMin] time (in minutes) for which Alerts - * should be throttled + * should be throttled or suppressed. * @member {object} trigger The trigger condition that results in the alert * rule being. * @member {string} [trigger.thresholdOperator] Evaluation operation for rule @@ -95,27 +96,6 @@ class AlertingAction extends models['Action'] { uberParent: 'Action', className: 'AlertingAction', 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' - } - } - } - }, odatatype: { required: true, serializedName: 'odata\\.type', diff --git a/lib/services/monitorManagement/lib/models/azNsActionGroup.js b/lib/services/monitorManagement/lib/models/azNsActionGroup.js index 6a8177b293..c3d0dea8ee 100644 --- a/lib/services/monitorManagement/lib/models/azNsActionGroup.js +++ b/lib/services/monitorManagement/lib/models/azNsActionGroup.js @@ -11,16 +11,17 @@ 'use strict'; /** - * azns notification group + * Azure action group * */ class AzNsActionGroup { /** * Create a AzNsActionGroup. - * @member {array} [actionGroup] Azure Group reference. - * @member {string} [emailSubject] Custom subject for Azns email - * @member {string} [customWebhookPayload] Custom webhook payload to be send - * to azns action group + * @member {array} [actionGroup] Azure Action Group reference. + * @member {string} [emailSubject] Custom subject override for all email ids + * in Azure action group + * @member {string} [customWebhookPayload] Custom payload to be sent for all + * webook URI in Azure action group */ constructor() { } diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index fe85bf4a97..ff23b25b09 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -1994,18 +1994,16 @@ 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 {string} odatatype Polymorphic Discriminator */ -export interface Action { +export interface MetricAlertAction { actionGroupId?: string; webhookProperties?: { [propertyName: string]: string }; - odatatype: string; } /** @@ -2061,7 +2059,7 @@ export interface MetricAlertResource extends Resource { windowSize: moment.Duration; criteria: MetricAlertCriteria; autoMitigate?: boolean; - actions?: Action[]; + actions?: MetricAlertAction[]; readonly lastUpdatedTime?: Date; } @@ -2103,7 +2101,7 @@ export interface MetricAlertResourcePatch { windowSize: moment.Duration; criteria: MetricAlertCriteria; autoMitigate?: boolean; - actions?: Action[]; + actions?: MetricAlertAction[]; readonly lastUpdatedTime?: Date; } @@ -2216,7 +2214,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA * * @member {string} query Log search query. * @member {array} [authorizedResources] List of Resource referred into query - * @member {string} datasourceId The resource uri over which log search query + * @member {string} dataSourceId The resource uri over which log search query * is to be run. * @member {string} [queryType] Set value to ResultCount if query should be * returning search result count. Set it to Number if its a metric query. @@ -2225,7 +2223,7 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA export interface Source { query: string; authorizedResources?: string[]; - datasourceId: string; + dataSourceId: string; queryType?: string; } @@ -2245,6 +2243,16 @@ export interface Schedule { timeWindowInMinutes: number; } +/** + * @class + * Initializes a new instance of the Action class. + * @constructor + * @member {string} odatatype Polymorphic Discriminator + */ +export interface Action { + odatatype: string; +} + /** * @class * Initializes a new instance of the LogSearchRuleResource class. @@ -2264,7 +2272,7 @@ export interface Schedule { * @member {string} [source.query] Log search query. * @member {array} [source.authorizedResources] List of Resource referred into * query - * @member {string} [source.datasourceId] The resource uri over which log + * @member {string} [source.dataSourceId] The resource uri over which log * search query is to be run. * @member {string} [source.queryType] Set value to ResultCount if query should * be returning search result count. Set it to Number if its a metric query. @@ -2276,8 +2284,6 @@ export interface Schedule { * 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.actionGroupId] the id of the action group to use. - * @member {object} [action.webhookProperties] * @member {string} [action.odatatype] Polymorphic Discriminator */ export interface LogSearchRuleResource extends Resource { @@ -2345,12 +2351,13 @@ export interface TriggerCondition { * @class * Initializes a new instance of the AzNsActionGroup class. * @constructor - * azns notification group + * Azure action group * - * @member {array} [actionGroup] Azure Group reference. - * @member {string} [emailSubject] Custom subject for Azns email - * @member {string} [customWebhookPayload] Custom webhook payload to be send to - * azns action group + * @member {array} [actionGroup] Azure Action Group reference. + * @member {string} [emailSubject] Custom subject override for all email ids in + * Azure action group + * @member {string} [customWebhookPayload] Custom payload to be sent for all + * webook URI in Azure action group */ export interface AzNsActionGroup { actionGroup?: string[]; @@ -2366,13 +2373,14 @@ export interface AzNsActionGroup { * * @member {string} severity Severity of the alert. Possible values include: * '0', '1', '2', '3', '4' - * @member {object} aznsAction azns notification group reference. - * @member {array} [aznsAction.actionGroup] Azure Group reference. - * @member {string} [aznsAction.emailSubject] Custom subject for Azns email - * @member {string} [aznsAction.customWebhookPayload] Custom webhook payload to - * be send to azns action group + * @member {object} aznsAction Azure action group reference. + * @member {array} [aznsAction.actionGroup] Azure Action Group reference. + * @member {string} [aznsAction.emailSubject] Custom subject override for all + * email ids in Azure action group + * @member {string} [aznsAction.customWebhookPayload] Custom payload to be sent + * for all webook URI in Azure action group * @member {number} [throttlingInMin] time (in minutes) for which Alerts should - * be throttled + * be throttled or suppressed. * @member {object} trigger The trigger condition that results in the alert * rule being. * @member {string} [trigger.thresholdOperator] Evaluation operation for rule - diff --git a/lib/services/monitorManagement/lib/models/index.js b/lib/services/monitorManagement/lib/models/index.js index b863800b50..101829eb53 100644 --- a/lib/services/monitorManagement/lib/models/index.js +++ b/lib/services/monitorManagement/lib/models/index.js @@ -95,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'); @@ -107,6 +107,7 @@ 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.TriggerCondition = require('./triggerCondition'); exports.AzNsActionGroup = require('./azNsActionGroup'); @@ -133,8 +134,8 @@ exports.discriminators = { 'RuleAction' : exports.RuleAction, 'RuleAction.Microsoft.Azure.Management.Insights.Models.RuleEmailAction' : exports.RuleEmailAction, 'RuleAction.Microsoft.Azure.Management.Insights.Models.RuleWebhookAction' : exports.RuleWebhookAction, - 'Action' : exports.Action, 'MetricAlertCriteria' : exports.MetricAlertCriteria, 'MetricAlertCriteria.Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria' : exports.MetricAlertSingleResourceMultipleMetricCriteria, + 'Action' : exports.Action, 'Action.Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction' : exports.AlertingAction }; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js index d791a93e32..845b00e8b5 100644 --- a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -33,7 +33,7 @@ class LogSearchRuleResource extends models['Resource'] { * @member {string} [source.query] Log search query. * @member {array} [source.authorizedResources] List of Resource referred * into query - * @member {string} [source.datasourceId] The resource uri over which log + * @member {string} [source.dataSourceId] The resource uri over which log * search query is to be run. * @member {string} [source.queryType] Set value to ResultCount if query * should be returning search result count. Set it to Number if its a metric @@ -45,8 +45,6 @@ class LogSearchRuleResource extends models['Resource'] { * 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.actionGroupId] the id of the action group to use. - * @member {object} [action.webhookProperties] * @member {string} [action.odatatype] Polymorphic Discriminator */ constructor() { diff --git a/lib/services/monitorManagement/lib/models/metricAlertAction.js b/lib/services/monitorManagement/lib/models/metricAlertAction.js new file mode 100644 index 0000000000..839c184556 --- /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] + */ + 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 9b17b18760..867cdcff89 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertResource.js +++ b/lib/services/monitorManagement/lib/models/metricAlertResource.js @@ -192,15 +192,10 @@ class MetricAlertResource extends models['Resource'] { name: 'Sequence', element: { required: false, - serializedName: 'ActionElementType', + serializedName: 'MetricAlertActionElementType', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'Action', - className: 'Action' + className: 'MetricAlertAction' } } } diff --git a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js index 2d5d6c286f..2211860368 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js +++ b/lib/services/monitorManagement/lib/models/metricAlertResourcePatch.js @@ -160,15 +160,10 @@ class MetricAlertResourcePatch { name: 'Sequence', element: { required: false, - serializedName: 'ActionElementType', + serializedName: 'MetricAlertActionElementType', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'Action', - className: 'Action' + className: 'MetricAlertAction' } } } diff --git a/lib/services/monitorManagement/lib/models/source.js b/lib/services/monitorManagement/lib/models/source.js index 21f7bc859f..117d39a951 100644 --- a/lib/services/monitorManagement/lib/models/source.js +++ b/lib/services/monitorManagement/lib/models/source.js @@ -20,7 +20,7 @@ class 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 + * @member {string} dataSourceId The resource uri over which log search query * is to be run. * @member {string} [queryType] Set value to ResultCount if query should be * returning search result count. Set it to Number if its a metric query. @@ -64,9 +64,9 @@ class Source { } } }, - datasourceId: { + dataSourceId: { required: true, - serializedName: 'datasourceId', + serializedName: 'dataSourceId', type: { name: 'String' } diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index 69e78676ea..544b3a320f 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -4330,7 +4330,7 @@ export interface ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -4350,11 +4350,6 @@ export interface ScheduledQueryRules { * @param {object} parameters.action Action needs to be taken on rule * execution. * - * @param {string} [parameters.action.actionGroupId] the id of the action group - * to use. - * - * @param {object} [parameters.action.webhookProperties] - * * @param {string} parameters.action.odatatype Polymorphic Discriminator * * @param {string} parameters.location Resource location @@ -4398,7 +4393,7 @@ export interface ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -4418,11 +4413,6 @@ export interface ScheduledQueryRules { * @param {object} parameters.action Action needs to be taken on rule * execution. * - * @param {string} [parameters.action.actionGroupId] the id of the action group - * to use. - * - * @param {object} [parameters.action.webhookProperties] - * * @param {string} parameters.action.odatatype Polymorphic Discriminator * * @param {string} parameters.location Resource location diff --git a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js index fc6215f9d0..43001b1858 100644 --- a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -38,7 +38,7 @@ const WebResource = msRest.WebResource; * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -58,11 +58,6 @@ const WebResource = msRest.WebResource; * @param {object} parameters.action Action needs to be taken on rule * execution. * - * @param {string} [parameters.action.actionGroupId] the id of the action group - * to use. - * - * @param {object} [parameters.action.webhookProperties] - * * @param {string} parameters.action.odatatype Polymorphic Discriminator * * @param {string} parameters.location Resource location @@ -843,7 +838,7 @@ class ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -863,11 +858,6 @@ class ScheduledQueryRules { * @param {object} parameters.action Action needs to be taken on rule * execution. * - * @param {string} [parameters.action.actionGroupId] the id of the action group - * to use. - * - * @param {object} [parameters.action.webhookProperties] - * * @param {string} parameters.action.odatatype Polymorphic Discriminator * * @param {string} parameters.location Resource location @@ -923,7 +913,7 @@ class ScheduledQueryRules { * @param {array} [parameters.source.authorizedResources] List of Resource * referred into query * - * @param {string} parameters.source.datasourceId The resource uri over which + * @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 if @@ -943,11 +933,6 @@ class ScheduledQueryRules { * @param {object} parameters.action Action needs to be taken on rule * execution. * - * @param {string} [parameters.action.actionGroupId] the id of the action group - * to use. - * - * @param {object} [parameters.action.webhookProperties] - * * @param {string} parameters.action.odatatype Polymorphic Discriminator * * @param {string} parameters.location Resource location From 3ccff0dc2dbd4d505a7cc24e65bd065328a651e9 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 5 Jun 2018 11:20:32 -0700 Subject: [PATCH 11/14] [AutoPR monitor/resource-manager] Adding patch support for SQR API (#2886) * Generated from f53526896e5c001f79bd46ca892f825172b53abf Merge branch 'master' into patchsupport * Generated from 0fa2c60b9a9e552cdcb523005b2136ae474a4d89 Updated description for queryType Updated description for queryType * Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67 Resolving multiple model issue Changes - 1. Renamed "MetricTrigger" to "LogMetricTrigger" 2. Aligned "Resources" to other specs * Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67 Resolving multiple model issue Changes - 1. Renamed "MetricTrigger" to "LogMetricTrigger" 2. Aligned "Resources" to other specs --- .../lib/models/alertingAction.js | 26 +- .../monitorManagement/lib/models/index.d.ts | 115 +++---- .../monitorManagement/lib/models/index.js | 2 + .../lib/models/logMetricTrigger.js | 79 +++++ .../lib/models/logSearchRuleResource.js | 5 +- .../lib/models/logSearchRuleResourcePatch.js | 69 +++++ .../lib/models/metricTrigger.js | 28 -- .../monitorManagement/lib/models/scaleRule.js | 7 - .../monitorManagement/lib/models/source.js | 5 +- .../lib/models/triggerCondition.js | 28 +- .../lib/operations/index.d.ts | 85 +++++- .../lib/operations/scheduledQueryRules.js | 287 +++++++++++++++++- 12 files changed, 556 insertions(+), 180 deletions(-) create mode 100644 lib/services/monitorManagement/lib/models/logMetricTrigger.js create mode 100644 lib/services/monitorManagement/lib/models/logSearchRuleResourcePatch.js diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js index 7a23c3c73c..8348e8945f 100644 --- a/lib/services/monitorManagement/lib/models/alertingAction.js +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -39,34 +39,10 @@ class AlertingAction extends models['Action'] { * which rule should be triggered. * @member {object} [trigger.metricTrigger] Trigger condition for metric * query rule - * @member {string} [trigger.metricTrigger.metricName] the name of the metric - * that defines what the rule monitors. - * @member {string} [trigger.metricTrigger.metricResourceUri] the resource - * identifier of the resource the rule monitors. - * @member {moment.duration} [trigger.metricTrigger.timeGrain] the - * granularity of metrics the rule monitors. Must be one of the predefined - * values returned from metric definitions for the metric. Must be between 12 - * hours and 1 minute. - * @member {string} [trigger.metricTrigger.statistic] the metric statistic - * type. How the metrics from multiple instances are combined. Possible - * values include: 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [trigger.metricTrigger.timeWindow] the range of - * time in which instance data is collected. This value must be greater than - * the delay in metric collection, which can vary from resource-to-resource. - * Must be between 12 hours and 5 minutes. - * @member {string} [trigger.metricTrigger.timeAggregation] time aggregation - * type. How the data that is collected should be combined over time. The - * default value is Average. Possible values include: 'Average', 'Minimum', - * 'Maximum', 'Total', 'Count' - * @member {string} [trigger.metricTrigger.operator] the operator that is - * used to compare the metric data and the threshold. Possible values - * include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', - * 'LessThan', 'LessThanOrEqual' - * @member {number} [trigger.metricTrigger.threshold] the threshold of the - * metric that triggers the scale action. * @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible * values include: 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [trigger.metricTrigger.threshold] * @member {string} [trigger.metricTrigger.metricTriggerType] Metric Trigger * Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', * 'Total' diff --git a/lib/services/monitorManagement/lib/models/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index ff23b25b09..d37350de68 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -84,12 +84,6 @@ export interface ScaleCapacity { * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' * @member {number} threshold the threshold of the metric that triggers the * scale action. - * @member {string} [thresholdOperator] Evaluation operation for Metric - * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: - * 'GreaterThan', 'LessThan', 'Equal' - * @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' or - * 'Total'. Possible values include: 'Consecutive', 'Total' - * @member {string} [metricColumn] Evaluation of metric on a particular column */ export interface MetricTrigger { metricName: string; @@ -100,9 +94,6 @@ export interface MetricTrigger { timeAggregation: string; operator: string; threshold: number; - thresholdOperator?: string; - metricTriggerType?: string; - metricColumn?: string; } /** @@ -163,13 +154,6 @@ export interface ScaleAction { * 'LessThanOrEqual' * @member {number} [metricTrigger.threshold] the threshold of the metric that * triggers the scale action. - * @member {string} [metricTrigger.thresholdOperator] Evaluation operation for - * Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: - * 'GreaterThan', 'LessThan', 'Equal' - * @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type - - * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' - * @member {string} [metricTrigger.metricColumn] Evaluation of metric on a - * particular column * @member {object} scaleAction the parameters for the scaling action. * @member {string} [scaleAction.direction] the scale direction. Whether the * scaling action increases or decreases the number of instances. Possible @@ -2216,9 +2200,8 @@ export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricA * @member {array} [authorizedResources] List of Resource referred into query * @member {string} dataSourceId The resource uri over which log search query * is to be run. - * @member {string} [queryType] Set value to ResultCount if query should be - * returning search result count. Set it to Number if its a metric query. - * Possible values include: 'ResultCount' + * @member {string} [queryType] Set value to 'ResultCount'. Possible values + * include: 'ResultCount' */ export interface Source { query: string; @@ -2274,9 +2257,8 @@ export interface Action { * query * @member {string} [source.dataSourceId] The resource uri over which log * search query is to be run. - * @member {string} [source.queryType] Set value to ResultCount if query should - * be returning search result count. Set it to Number if its a metric query. - * Possible values include: 'ResultCount' + * @member {string} [source.queryType] Set value to 'ResultCount'. Possible + * values include: 'ResultCount' * @member {object} schedule Schedule (Frequnecy, Time Window) for rule. * @member {number} [schedule.frequencyInMinutes] frequency (in minutes) at * which rule condition should be evaluated. @@ -2296,6 +2278,41 @@ export interface LogSearchRuleResource extends Resource { action: Action; } +/** + * @class + * Initializes a new instance of the LogSearchRuleResourcePatch class. + * @constructor + * The log search rule resource for patch operations. + * + * @member {object} [tags] Resource tags + * @member {string} [enabled] The flag which indicates whether the Log Search + * rule is enabled. Value should be true or false. Possible values include: + * 'true', 'false' + */ +export interface LogSearchRuleResourcePatch { + tags?: { [propertyName: string]: string }; + enabled?: string; +} + +/** + * @class + * Initializes a new instance of the LogMetricTrigger class. + * @constructor + * @member {string} [thresholdOperator] Evaluation operation for Metric + * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [threshold] + * @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' or + * 'Total'. Possible values include: 'Consecutive', 'Total' + * @member {string} [metricColumn] Evaluation of metric on a particular column + */ +export interface LogMetricTrigger { + thresholdOperator?: string; + threshold?: number; + metricTriggerType?: string; + metricColumn?: string; +} + /** * @class * Initializes a new instance of the TriggerCondition class. @@ -2308,34 +2325,10 @@ export interface LogSearchRuleResource extends Resource { * @member {number} threshold Result or count threshold based on which rule * should be triggered. * @member {object} [metricTrigger] Trigger condition for metric query rule - * @member {string} [metricTrigger.metricName] the name of the metric that - * defines what the rule monitors. - * @member {string} [metricTrigger.metricResourceUri] the resource identifier - * of the resource the rule monitors. - * @member {moment.duration} [metricTrigger.timeGrain] the granularity of - * metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [metricTrigger.statistic] the metric statistic type. How - * the metrics from multiple instances are combined. Possible values include: - * 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [metricTrigger.timeWindow] the range of time in - * which instance data is collected. This value must be greater than the delay - * in metric collection, which can vary from resource-to-resource. Must be - * between 12 hours and 5 minutes. - * @member {string} [metricTrigger.timeAggregation] time aggregation type. How - * the data that is collected should be combined over time. The default value - * is Average. Possible values include: 'Average', 'Minimum', 'Maximum', - * 'Total', 'Count' - * @member {string} [metricTrigger.operator] the operator that is used to - * compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [metricTrigger.threshold] the threshold of the metric that - * triggers the scale action. * @member {string} [metricTrigger.thresholdOperator] Evaluation operation for * Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: * 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [metricTrigger.threshold] * @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type - * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' * @member {string} [metricTrigger.metricColumn] Evaluation of metric on a @@ -2344,7 +2337,7 @@ export interface LogSearchRuleResource extends Resource { export interface TriggerCondition { thresholdOperator: string; threshold: number; - metricTrigger?: MetricTrigger; + metricTrigger?: LogMetricTrigger; } /** @@ -2390,34 +2383,10 @@ export interface AzNsActionGroup { * which rule should be triggered. * @member {object} [trigger.metricTrigger] Trigger condition for metric query * rule - * @member {string} [trigger.metricTrigger.metricName] the name of the metric - * that defines what the rule monitors. - * @member {string} [trigger.metricTrigger.metricResourceUri] the resource - * identifier of the resource the rule monitors. - * @member {moment.duration} [trigger.metricTrigger.timeGrain] the granularity - * of metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [trigger.metricTrigger.statistic] the metric statistic - * type. How the metrics from multiple instances are combined. Possible values - * include: 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [trigger.metricTrigger.timeWindow] the range of - * time in which instance data is collected. This value must be greater than - * the delay in metric collection, which can vary from resource-to-resource. - * Must be between 12 hours and 5 minutes. - * @member {string} [trigger.metricTrigger.timeAggregation] time aggregation - * type. How the data that is collected should be combined over time. The - * default value is Average. Possible values include: 'Average', 'Minimum', - * 'Maximum', 'Total', 'Count' - * @member {string} [trigger.metricTrigger.operator] the operator that is used - * to compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [trigger.metricTrigger.threshold] the threshold of the - * metric that triggers the scale action. * @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible * values include: 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [trigger.metricTrigger.threshold] * @member {string} [trigger.metricTrigger.metricTriggerType] Metric Trigger * Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', * 'Total' diff --git a/lib/services/monitorManagement/lib/models/index.js b/lib/services/monitorManagement/lib/models/index.js index 101829eb53..52f190460c 100644 --- a/lib/services/monitorManagement/lib/models/index.js +++ b/lib/services/monitorManagement/lib/models/index.js @@ -109,6 +109,8 @@ exports.Source = require('./source'); exports.Schedule = require('./schedule'); exports.Action = require('./action'); exports.LogSearchRuleResource = require('./logSearchRuleResource'); +exports.LogSearchRuleResourcePatch = require('./logSearchRuleResourcePatch'); +exports.LogMetricTrigger = require('./logMetricTrigger'); exports.TriggerCondition = require('./triggerCondition'); exports.AzNsActionGroup = require('./azNsActionGroup'); exports.AlertingAction = require('./alertingAction'); diff --git a/lib/services/monitorManagement/lib/models/logMetricTrigger.js b/lib/services/monitorManagement/lib/models/logMetricTrigger.js new file mode 100644 index 0000000000..2af865ec82 --- /dev/null +++ b/lib/services/monitorManagement/lib/models/logMetricTrigger.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'; + +/** + * Class representing a LogMetricTrigger. + */ +class LogMetricTrigger { + /** + * Create a LogMetricTrigger. + * @member {string} [thresholdOperator] Evaluation operation for Metric + * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: + * 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [threshold] + * @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' + * or 'Total'. Possible values include: 'Consecutive', 'Total' + * @member {string} [metricColumn] Evaluation of metric on a particular + * column + */ + constructor() { + } + + /** + * Defines the metadata of LogMetricTrigger + * + * @returns {object} metadata of LogMetricTrigger + * + */ + mapper() { + return { + required: false, + serializedName: 'LogMetricTrigger', + type: { + name: 'Composite', + className: 'LogMetricTrigger', + modelProperties: { + thresholdOperator: { + required: false, + serializedName: 'thresholdOperator', + type: { + name: 'String' + } + }, + threshold: { + required: false, + serializedName: 'threshold', + type: { + name: 'Number' + } + }, + metricTriggerType: { + required: false, + serializedName: 'metricTriggerType', + type: { + name: 'String' + } + }, + metricColumn: { + required: false, + serializedName: 'metricColumn', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LogMetricTrigger; diff --git a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js index 845b00e8b5..138f18b726 100644 --- a/lib/services/monitorManagement/lib/models/logSearchRuleResource.js +++ b/lib/services/monitorManagement/lib/models/logSearchRuleResource.js @@ -35,9 +35,8 @@ class LogSearchRuleResource extends models['Resource'] { * into query * @member {string} [source.dataSourceId] The resource uri over which log * search query is to be run. - * @member {string} [source.queryType] Set value to ResultCount if query - * should be returning search result count. Set it to Number if its a metric - * query. Possible values include: 'ResultCount' + * @member {string} [source.queryType] Set value to 'ResultCount'. Possible + * values include: 'ResultCount' * @member {object} schedule Schedule (Frequnecy, Time Window) for rule. * @member {number} [schedule.frequencyInMinutes] frequency (in minutes) at * which rule condition should be evaluated. 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/metricTrigger.js b/lib/services/monitorManagement/lib/models/metricTrigger.js index 3591915bf6..09e76603e5 100644 --- a/lib/services/monitorManagement/lib/models/metricTrigger.js +++ b/lib/services/monitorManagement/lib/models/metricTrigger.js @@ -39,13 +39,6 @@ class MetricTrigger { * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' * @member {number} threshold the threshold of the metric that triggers the * scale action. - * @member {string} [thresholdOperator] Evaluation operation for Metric - * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: - * 'GreaterThan', 'LessThan', 'Equal' - * @member {string} [metricTriggerType] Metric Trigger Type - 'Consecutive' - * or 'Total'. Possible values include: 'Consecutive', 'Total' - * @member {string} [metricColumn] Evaluation of metric on a particular - * column */ constructor() { } @@ -122,27 +115,6 @@ class MetricTrigger { type: { name: 'Number' } - }, - thresholdOperator: { - required: false, - serializedName: 'thresholdOperator', - type: { - name: 'String' - } - }, - metricTriggerType: { - required: false, - serializedName: 'metricTriggerType', - type: { - name: 'String' - } - }, - metricColumn: { - required: false, - serializedName: 'metricColumn', - type: { - name: 'String' - } } } } diff --git a/lib/services/monitorManagement/lib/models/scaleRule.js b/lib/services/monitorManagement/lib/models/scaleRule.js index 3114436dd0..0836d498c2 100644 --- a/lib/services/monitorManagement/lib/models/scaleRule.js +++ b/lib/services/monitorManagement/lib/models/scaleRule.js @@ -46,13 +46,6 @@ class ScaleRule { * 'LessThanOrEqual' * @member {number} [metricTrigger.threshold] the threshold of the metric * that triggers the scale action. - * @member {string} [metricTrigger.thresholdOperator] Evaluation operation - * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values - * include: 'GreaterThan', 'LessThan', 'Equal' - * @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type - - * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' - * @member {string} [metricTrigger.metricColumn] Evaluation of metric on a - * particular column * @member {object} scaleAction the parameters for the scaling action. * @member {string} [scaleAction.direction] the scale direction. Whether the * scaling action increases or decreases the number of instances. Possible diff --git a/lib/services/monitorManagement/lib/models/source.js b/lib/services/monitorManagement/lib/models/source.js index 117d39a951..d576129d8a 100644 --- a/lib/services/monitorManagement/lib/models/source.js +++ b/lib/services/monitorManagement/lib/models/source.js @@ -22,9 +22,8 @@ class Source { * query * @member {string} dataSourceId The resource uri over which log search query * is to be run. - * @member {string} [queryType] Set value to ResultCount if query should be - * returning search result count. Set it to Number if its a metric query. - * Possible values include: 'ResultCount' + * @member {string} [queryType] Set value to 'ResultCount'. Possible values + * include: 'ResultCount' */ constructor() { } diff --git a/lib/services/monitorManagement/lib/models/triggerCondition.js b/lib/services/monitorManagement/lib/models/triggerCondition.js index 2db331d533..9238fb4928 100644 --- a/lib/services/monitorManagement/lib/models/triggerCondition.js +++ b/lib/services/monitorManagement/lib/models/triggerCondition.js @@ -25,34 +25,10 @@ class TriggerCondition { * @member {number} threshold Result or count threshold based on which rule * should be triggered. * @member {object} [metricTrigger] Trigger condition for metric query rule - * @member {string} [metricTrigger.metricName] the name of the metric that - * defines what the rule monitors. - * @member {string} [metricTrigger.metricResourceUri] the resource identifier - * of the resource the rule monitors. - * @member {moment.duration} [metricTrigger.timeGrain] the granularity of - * metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [metricTrigger.statistic] the metric statistic type. How - * the metrics from multiple instances are combined. Possible values include: - * 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [metricTrigger.timeWindow] the range of time in - * which instance data is collected. This value must be greater than the - * delay in metric collection, which can vary from resource-to-resource. Must - * be between 12 hours and 5 minutes. - * @member {string} [metricTrigger.timeAggregation] time aggregation type. - * How the data that is collected should be combined over time. The default - * value is Average. Possible values include: 'Average', 'Minimum', - * 'Maximum', 'Total', 'Count' - * @member {string} [metricTrigger.operator] the operator that is used to - * compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [metricTrigger.threshold] the threshold of the metric - * that triggers the scale action. * @member {string} [metricTrigger.thresholdOperator] Evaluation operation * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values * include: 'GreaterThan', 'LessThan', 'Equal' + * @member {number} [metricTrigger.threshold] * @member {string} [metricTrigger.metricTriggerType] Metric Trigger Type - * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total' * @member {string} [metricTrigger.metricColumn] Evaluation of metric on a @@ -94,7 +70,7 @@ class TriggerCondition { serializedName: 'metricTrigger', type: { name: 'Composite', - className: 'MetricTrigger' + className: 'LogMetricTrigger' } } } diff --git a/lib/services/monitorManagement/lib/operations/index.d.ts b/lib/services/monitorManagement/lib/operations/index.d.ts index 544b3a320f..59f94d7ec9 100644 --- a/lib/services/monitorManagement/lib/operations/index.d.ts +++ b/lib/services/monitorManagement/lib/operations/index.d.ts @@ -4333,9 +4333,8 @@ export interface ScheduledQueryRules { * @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 if - * query should be returning search result count. Set it to Number if its a - * metric query. Possible values include: 'ResultCount' + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' * * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for * rule. @@ -4396,9 +4395,8 @@ export interface ScheduledQueryRules { * @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 if - * query should be returning search result count. Set it to Number if its a - * metric query. Possible values include: 'ResultCount' + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' * * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for * rule. @@ -4510,6 +4508,81 @@ export interface ScheduledQueryRules { 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 * diff --git a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js index 43001b1858..40352ff697 100644 --- a/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js +++ b/lib/services/monitorManagement/lib/operations/scheduledQueryRules.js @@ -41,9 +41,8 @@ const WebResource = msRest.WebResource; * @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 if - * query should be returning search result count. Set it to Number if its a - * metric query. Possible values include: 'ResultCount' + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' * * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for * rule. @@ -379,6 +378,175 @@ function _get(resourceGroupName, ruleName, options, callback) { }); } +/** + * 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 * @@ -809,6 +977,7 @@ class ScheduledQueryRules { this.client = client; this._createOrUpdate = _createOrUpdate; this._get = _get; + this._update = _update; this._deleteMethod = _deleteMethod; this._listBySubscription = _listBySubscription; this._listByResourceGroup = _listByResourceGroup; @@ -841,9 +1010,8 @@ class ScheduledQueryRules { * @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 if - * query should be returning search result count. Set it to Number if its a - * metric query. Possible values include: 'ResultCount' + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' * * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for * rule. @@ -916,9 +1084,8 @@ class ScheduledQueryRules { * @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 if - * query should be returning search result count. Set it to Number if its a - * metric query. Possible values include: 'ResultCount' + * @param {string} [parameters.source.queryType] Set value to 'ResultCount'. + * Possible values include: 'ResultCount' * * @param {object} parameters.schedule Schedule (Frequnecy, Time Window) for * rule. @@ -1072,6 +1239,108 @@ class ScheduledQueryRules { } } + /** + * 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 * From 680041f2f052871faaa73085fb07a444fc7223de Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 25 Jun 2018 09:59:21 -0700 Subject: [PATCH 12/14] [AutoPR monitor/resource-manager] Add two missing "by subscription" operations for completeness and compliance (#3043) * Generated from 4afd2b6cd7da03f1f623144e33df0c923c56ba05 Add two missing "by subscription" operations. * Generated from 840fcf1cde3e9644d365599339033b58288ad7e3 Remove "examples" nodes as requested since they are not used anymore. Adding documentation to reduce number of warnings in validation. * Generated from 8e22a0641dc1ac873b046bdbdc934ad5525cb814 Add the serviceBusRuleId back into the DiagnosticSetting resource spec. --- .../monitorManagement/lib/models/action.js | 3 +- .../lib/models/alertingAction.js | 3 +- .../lib/models/diagnosticSettingsResource.js | 9 + .../monitorManagement/lib/models/eventData.js | 2 +- .../monitorManagement/lib/models/index.d.ts | 29 +- .../lib/models/logMetricTrigger.js | 5 +- .../lib/models/metricAlertAction.js | 2 +- .../lib/models/metricAlertStatus.js | 3 +- .../lib/models/metricAlertStatusProperties.js | 3 +- .../lib/models/metricCriteria.js | 3 +- .../lib/models/metricDimension.js | 3 +- .../lib/models/triggerCondition.js | 3 +- .../lib/operations/alertRules.js | 212 +++++++++ .../lib/operations/autoscaleSettings.js | 428 ++++++++++++++++++ .../diagnosticSettingsOperations.js | 9 + .../lib/operations/index.d.ts | 168 +++++++ 16 files changed, 867 insertions(+), 18 deletions(-) diff --git a/lib/services/monitorManagement/lib/models/action.js b/lib/services/monitorManagement/lib/models/action.js index 282636d503..60cf981165 100644 --- a/lib/services/monitorManagement/lib/models/action.js +++ b/lib/services/monitorManagement/lib/models/action.js @@ -11,7 +11,8 @@ 'use strict'; /** - * Class representing a Action. + * Action descriptor. + * */ class Action { /** diff --git a/lib/services/monitorManagement/lib/models/alertingAction.js b/lib/services/monitorManagement/lib/models/alertingAction.js index 8348e8945f..03ee8274af 100644 --- a/lib/services/monitorManagement/lib/models/alertingAction.js +++ b/lib/services/monitorManagement/lib/models/alertingAction.js @@ -42,7 +42,8 @@ class AlertingAction extends models['Action'] { * @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible * values include: 'GreaterThan', 'LessThan', 'Equal' - * @member {number} [trigger.metricTrigger.threshold] + * @member {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' 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 d37350de68..b459593228 100644 --- a/lib/services/monitorManagement/lib/models/index.d.ts +++ b/lib/services/monitorManagement/lib/models/index.d.ts @@ -1126,6 +1126,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 +1141,7 @@ export interface LogSettings { */ export interface DiagnosticSettingsResource extends ProxyOnlyResource { storageAccountId?: string; + serviceBusRuleId?: string; eventHubAuthorizationRuleId?: string; eventHubName?: string; metrics?: MetricSettings[]; @@ -1594,7 +1597,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: @@ -1983,7 +1986,7 @@ export interface CalculateBaselineResponse { * 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 MetricAlertAction { actionGroupId?: string; @@ -2095,7 +2098,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. */ @@ -2116,7 +2120,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. */ @@ -2143,6 +2148,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. @@ -2157,6 +2164,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. @@ -2230,6 +2239,8 @@ export interface Schedule { * @class * Initializes a new instance of the Action class. * @constructor + * Action descriptor. + * * @member {string} odatatype Polymorphic Discriminator */ export interface Action { @@ -2298,10 +2309,12 @@ export interface LogSearchRuleResourcePatch { * @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] + * @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 @@ -2328,7 +2341,8 @@ export interface LogMetricTrigger { * @member {string} [metricTrigger.thresholdOperator] Evaluation operation for * Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: * 'GreaterThan', 'LessThan', 'Equal' - * @member {number} [metricTrigger.threshold] + * @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 @@ -2386,7 +2400,8 @@ export interface AzNsActionGroup { * @member {string} [trigger.metricTrigger.thresholdOperator] Evaluation * operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible * values include: 'GreaterThan', 'LessThan', 'Equal' - * @member {number} [trigger.metricTrigger.threshold] + * @member {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' diff --git a/lib/services/monitorManagement/lib/models/logMetricTrigger.js b/lib/services/monitorManagement/lib/models/logMetricTrigger.js index 2af865ec82..9f50a4aaf4 100644 --- a/lib/services/monitorManagement/lib/models/logMetricTrigger.js +++ b/lib/services/monitorManagement/lib/models/logMetricTrigger.js @@ -11,7 +11,8 @@ 'use strict'; /** - * Class representing a LogMetricTrigger. + * A log metrics trigger descriptor. + * */ class LogMetricTrigger { /** @@ -19,7 +20,7 @@ class LogMetricTrigger { * @member {string} [thresholdOperator] Evaluation operation for Metric * -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: * 'GreaterThan', 'LessThan', 'Equal' - * @member {number} [threshold] + * @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 diff --git a/lib/services/monitorManagement/lib/models/metricAlertAction.js b/lib/services/monitorManagement/lib/models/metricAlertAction.js index 839c184556..2b70ef2515 100644 --- a/lib/services/monitorManagement/lib/models/metricAlertAction.js +++ b/lib/services/monitorManagement/lib/models/metricAlertAction.js @@ -18,7 +18,7 @@ class MetricAlertAction { /** * Create a MetricAlertAction. * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] + * @member {object} [webhookProperties] The properties of a webhook object. */ constructor() { } 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/triggerCondition.js b/lib/services/monitorManagement/lib/models/triggerCondition.js index 9238fb4928..b69f6b6a0a 100644 --- a/lib/services/monitorManagement/lib/models/triggerCondition.js +++ b/lib/services/monitorManagement/lib/models/triggerCondition.js @@ -28,7 +28,8 @@ class TriggerCondition { * @member {string} [metricTrigger.thresholdOperator] Evaluation operation * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values * include: 'GreaterThan', 'LessThan', 'Equal' - * @member {number} [metricTrigger.threshold] + * @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 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 59f94d7ec9..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. * From 23d6cbebc33257f07bb24443b73051a17feaab53 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 20 Jul 2018 13:49:46 -0700 Subject: [PATCH 13/14] Generated from 6110295138cbd6959df204de3830b4ada943a4fc (#3210) updated description of recurrent frequency --- .../monitorManagement/lib/models/autoscaleProfile.js | 5 ----- lib/services/monitorManagement/lib/models/index.d.ts | 9 --------- lib/services/monitorManagement/lib/models/recurrence.js | 9 +++------ 3 files changed, 3 insertions(+), 20 deletions(-) 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/index.d.ts b/lib/services/monitorManagement/lib/models/index.d.ts index b459593228..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 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: { From 0a077f9af09464e8fb1b5b646b89b0512d04fd5d Mon Sep 17 00:00:00 2001 From: Dan Schulte Date: Fri, 20 Jul 2018 14:59:38 -0700 Subject: [PATCH 14/14] Remove old monitor folder, regenerate version 3.0.0 of azure-arm-monitor --- lib/services/monitor/lib/LICENSE.txt | 21 - lib/services/monitor/lib/lib/models/action.js | 67 - .../monitor/lib/lib/models/actionGroupList.js | 61 - .../lib/lib/models/actionGroupPatchBody.js | 70 - .../lib/lib/models/actionGroupResource.js | 269 -- .../lib/models/activityLogAlertActionGroup.js | 70 - .../lib/models/activityLogAlertActionList.js | 62 - .../models/activityLogAlertAllOfCondition.js | 63 - .../models/activityLogAlertLeafCondition.js | 66 - .../lib/lib/models/activityLogAlertList.js | 61 - .../lib/models/activityLogAlertPatchBody.js | 70 - .../lib/models/activityLogAlertResource.js | 153 - .../lib/lib/models/alertRuleResource.js | 175 - .../lib/models/alertRuleResourceCollection.js | 59 - .../lib/lib/models/alertRuleResourcePatch.js | 143 - .../lib/models/automationRunbookReceiver.js | 95 - .../lib/lib/models/autoscaleNotification.js | 86 - .../lib/lib/models/autoscaleProfile.js | 204 - .../lib/models/autoscaleSettingResource.js | 159 - .../autoscaleSettingResourceCollection.js | 67 - .../models/autoscaleSettingResourcePatch.js | 126 - .../lib/lib/models/azureAppPushReceiver.js | 62 - .../lib/lib/models/azureFunctionReceiver.js | 79 - .../monitor/lib/lib/models/baseline.js | 84 - .../lib/lib/models/baselineMetadataValue.js | 65 - .../lib/lib/models/baselineResponse.js | 154 - .../lib/models/calculateBaselineResponse.js | 85 - .../diagnosticSettingsCategoryResource.js | 82 - ...osticSettingsCategoryResourceCollection.js | 63 - .../lib/models/diagnosticSettingsResource.js | 142 - .../diagnosticSettingsResourceCollection.js | 62 - .../lib/lib/models/emailNotification.js | 78 - .../monitor/lib/lib/models/emailReceiver.js | 72 - .../monitor/lib/lib/models/enableRequest.js | 52 - .../monitor/lib/lib/models/errorResponse.js | 61 - .../lib/lib/models/eventCategoryCollection.js | 60 - .../monitor/lib/lib/models/eventData.js | 342 -- .../lib/lib/models/eventDataCollection.js | 68 - .../monitor/lib/lib/models/httpRequestInfo.js | 76 - .../monitor/lib/lib/models/incident.js | 93 - .../lib/lib/models/incidentListResult.js | 59 - .../monitor/lib/lib/models/index.d.ts | 2298 --------- lib/services/monitor/lib/lib/models/index.js | 131 - .../monitor/lib/lib/models/itsmReceiver.js | 89 - .../lib/lib/models/localizableString.js | 60 - .../models/locationThresholdRuleCondition.js | 96 - .../lib/lib/models/logProfileCollection.js | 59 - .../lib/lib/models/logProfileResource.js | 161 - .../lib/lib/models/logProfileResourcePatch.js | 129 - .../monitor/lib/lib/models/logSettings.js | 79 - .../lib/lib/models/logicAppReceiver.js | 70 - .../managementEventAggregationCondition.js | 73 - .../models/managementEventRuleCondition.js | 94 - .../monitor/lib/lib/models/metadataValue.js | 65 - lib/services/monitor/lib/lib/models/metric.js | 102 - .../lib/lib/models/metricAlertCriteria.js | 70 - .../lib/lib/models/metricAlertResource.js | 208 - .../models/metricAlertResourceCollection.js | 59 - .../lib/models/metricAlertResourcePatch.js | 176 - ...ertSingleResourceMultipleMetricCriteria.js | 79 - .../lib/lib/models/metricAlertStatus.js | 84 - .../lib/models/metricAlertStatusCollection.js | 62 - .../lib/models/metricAlertStatusProperties.js | 75 - .../lib/lib/models/metricAvailability.js | 64 - .../monitor/lib/lib/models/metricCriteria.js | 110 - .../lib/lib/models/metricDefinition.js | 165 - .../lib/models/metricDefinitionCollection.js | 59 - .../monitor/lib/lib/models/metricDimension.js | 74 - .../monitor/lib/lib/models/metricSettings.js | 89 - .../monitor/lib/lib/models/metricTrigger.js | 125 - .../monitor/lib/lib/models/metricValue.js | 95 - .../monitor/lib/lib/models/operation.js | 68 - .../lib/lib/models/operationDisplay.js | 69 - .../lib/lib/models/operationListResult.js | 73 - .../lib/lib/models/proxyOnlyResource.js | 75 - .../monitor/lib/lib/models/recurrence.js | 114 - .../lib/lib/models/recurrentSchedule.js | 138 - .../monitor/lib/lib/models/resource.js | 98 - .../monitor/lib/lib/models/response.js | 113 - .../monitor/lib/lib/models/retentionPolicy.js | 65 - .../monitor/lib/lib/models/ruleAction.js | 59 - .../monitor/lib/lib/models/ruleCondition.js | 80 - .../monitor/lib/lib/models/ruleDataSource.js | 68 - .../monitor/lib/lib/models/ruleEmailAction.js | 88 - .../ruleManagementEventClaimsDataSource.js | 52 - .../models/ruleManagementEventDataSource.js | 145 - .../lib/lib/models/ruleMetricDataSource.js | 78 - .../lib/lib/models/ruleWebhookAction.js | 88 - .../monitor/lib/lib/models/scaleAction.js | 87 - .../monitor/lib/lib/models/scaleCapacity.js | 72 - .../monitor/lib/lib/models/scaleRule.js | 102 - .../lib/lib/models/senderAuthorization.js | 72 - .../monitor/lib/lib/models/smsReceiver.js | 80 - .../lib/lib/models/thresholdRuleCondition.js | 115 - .../lib/lib/models/timeSeriesElement.js | 81 - .../lib/lib/models/timeSeriesInformation.js | 90 - .../monitor/lib/lib/models/timeWindow.js | 105 - .../monitor/lib/lib/models/voiceReceiver.js | 69 - .../lib/lib/models/webhookNotification.js | 69 - .../monitor/lib/lib/models/webhookReceiver.js | 61 - .../lib/lib/monitorManagementClient.d.ts | 76 - .../lib/lib/monitorManagementClient.js | 100 - .../lib/lib/operations/actionGroups.js | 1810 ------- .../lib/lib/operations/activityLogAlerts.js | 1543 ------ .../lib/lib/operations/activityLogs.js | 545 --- .../lib/lib/operations/alertRuleIncidents.js | 500 -- .../monitor/lib/lib/operations/alertRules.js | 1423 ------ .../lib/lib/operations/autoscaleSettings.js | 1561 ------ .../diagnosticSettingsCategoryOperations.js | 479 -- .../diagnosticSettingsOperations.js | 991 ---- .../lib/lib/operations/eventCategories.js | 244 - .../monitor/lib/lib/operations/index.d.ts | 4284 ----------------- .../monitor/lib/lib/operations/index.js | 33 - .../monitor/lib/lib/operations/logProfiles.js | 1319 ----- .../lib/lib/operations/metricAlerts.js | 1590 ------ .../lib/lib/operations/metricAlertsStatus.js | 505 -- .../lib/lib/operations/metricBaseline.js | 642 --- .../lib/lib/operations/metricDefinitions.js | 264 - .../monitor/lib/lib/operations/metrics.js | 430 -- .../monitor/lib/lib/operations/operations.js | 235 - .../lib/lib/operations/tenantActivityLogs.js | 565 --- lib/services/monitor/lib/package.json | 22 - .../diagnosticSettingsCategoryResource.js | 1 + .../lib/monitorManagementClient.d.ts | 6 +- .../lib/monitorManagementClient.js | 6 +- .../monitorManagement/package-lock.json | 578 +++ lib/services/monitorManagement/package.json | 6 +- 127 files changed, 588 insertions(+), 30730 deletions(-) delete mode 100644 lib/services/monitor/lib/LICENSE.txt delete mode 100644 lib/services/monitor/lib/lib/models/action.js delete mode 100644 lib/services/monitor/lib/lib/models/actionGroupList.js delete mode 100644 lib/services/monitor/lib/lib/models/actionGroupPatchBody.js delete mode 100644 lib/services/monitor/lib/lib/models/actionGroupResource.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertActionList.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertList.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js delete mode 100644 lib/services/monitor/lib/lib/models/activityLogAlertResource.js delete mode 100644 lib/services/monitor/lib/lib/models/alertRuleResource.js delete mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/automationRunbookReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleNotification.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleProfile.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResource.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/azureAppPushReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/azureFunctionReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/baseline.js delete mode 100644 lib/services/monitor/lib/lib/models/baselineMetadataValue.js delete mode 100644 lib/services/monitor/lib/lib/models/baselineResponse.js delete mode 100644 lib/services/monitor/lib/lib/models/calculateBaselineResponse.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js delete mode 100644 lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/emailNotification.js delete mode 100644 lib/services/monitor/lib/lib/models/emailReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/enableRequest.js delete mode 100644 lib/services/monitor/lib/lib/models/errorResponse.js delete mode 100644 lib/services/monitor/lib/lib/models/eventCategoryCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/eventData.js delete mode 100644 lib/services/monitor/lib/lib/models/eventDataCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/httpRequestInfo.js delete mode 100644 lib/services/monitor/lib/lib/models/incident.js delete mode 100644 lib/services/monitor/lib/lib/models/incidentListResult.js delete mode 100644 lib/services/monitor/lib/lib/models/index.d.ts delete mode 100644 lib/services/monitor/lib/lib/models/index.js delete mode 100644 lib/services/monitor/lib/lib/models/itsmReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/localizableString.js delete mode 100644 lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/logProfileCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/logProfileResource.js delete mode 100644 lib/services/monitor/lib/lib/models/logProfileResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/logSettings.js delete mode 100644 lib/services/monitor/lib/lib/models/logicAppReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/managementEventRuleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/metadataValue.js delete mode 100644 lib/services/monitor/lib/lib/models/metric.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertCriteria.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertResource.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatus.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js delete mode 100644 lib/services/monitor/lib/lib/models/metricAvailability.js delete mode 100644 lib/services/monitor/lib/lib/models/metricCriteria.js delete mode 100644 lib/services/monitor/lib/lib/models/metricDefinition.js delete mode 100644 lib/services/monitor/lib/lib/models/metricDefinitionCollection.js delete mode 100644 lib/services/monitor/lib/lib/models/metricDimension.js delete mode 100644 lib/services/monitor/lib/lib/models/metricSettings.js delete mode 100644 lib/services/monitor/lib/lib/models/metricTrigger.js delete mode 100644 lib/services/monitor/lib/lib/models/metricValue.js delete mode 100644 lib/services/monitor/lib/lib/models/operation.js delete mode 100644 lib/services/monitor/lib/lib/models/operationDisplay.js delete mode 100644 lib/services/monitor/lib/lib/models/operationListResult.js delete mode 100644 lib/services/monitor/lib/lib/models/proxyOnlyResource.js delete mode 100644 lib/services/monitor/lib/lib/models/recurrence.js delete mode 100644 lib/services/monitor/lib/lib/models/recurrentSchedule.js delete mode 100644 lib/services/monitor/lib/lib/models/resource.js delete mode 100644 lib/services/monitor/lib/lib/models/response.js delete mode 100644 lib/services/monitor/lib/lib/models/retentionPolicy.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleAction.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleEmailAction.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleMetricDataSource.js delete mode 100644 lib/services/monitor/lib/lib/models/ruleWebhookAction.js delete mode 100644 lib/services/monitor/lib/lib/models/scaleAction.js delete mode 100644 lib/services/monitor/lib/lib/models/scaleCapacity.js delete mode 100644 lib/services/monitor/lib/lib/models/scaleRule.js delete mode 100644 lib/services/monitor/lib/lib/models/senderAuthorization.js delete mode 100644 lib/services/monitor/lib/lib/models/smsReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/thresholdRuleCondition.js delete mode 100644 lib/services/monitor/lib/lib/models/timeSeriesElement.js delete mode 100644 lib/services/monitor/lib/lib/models/timeSeriesInformation.js delete mode 100644 lib/services/monitor/lib/lib/models/timeWindow.js delete mode 100644 lib/services/monitor/lib/lib/models/voiceReceiver.js delete mode 100644 lib/services/monitor/lib/lib/models/webhookNotification.js delete mode 100644 lib/services/monitor/lib/lib/models/webhookReceiver.js delete mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.d.ts delete mode 100644 lib/services/monitor/lib/lib/monitorManagementClient.js delete mode 100644 lib/services/monitor/lib/lib/operations/actionGroups.js delete mode 100644 lib/services/monitor/lib/lib/operations/activityLogAlerts.js delete mode 100644 lib/services/monitor/lib/lib/operations/activityLogs.js delete mode 100644 lib/services/monitor/lib/lib/operations/alertRuleIncidents.js delete mode 100644 lib/services/monitor/lib/lib/operations/alertRules.js delete mode 100644 lib/services/monitor/lib/lib/operations/autoscaleSettings.js delete mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js delete mode 100644 lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js delete mode 100644 lib/services/monitor/lib/lib/operations/eventCategories.js delete mode 100644 lib/services/monitor/lib/lib/operations/index.d.ts delete mode 100644 lib/services/monitor/lib/lib/operations/index.js delete mode 100644 lib/services/monitor/lib/lib/operations/logProfiles.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricAlerts.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricAlertsStatus.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricBaseline.js delete mode 100644 lib/services/monitor/lib/lib/operations/metricDefinitions.js delete mode 100644 lib/services/monitor/lib/lib/operations/metrics.js delete mode 100644 lib/services/monitor/lib/lib/operations/operations.js delete mode 100644 lib/services/monitor/lib/lib/operations/tenantActivityLogs.js delete mode 100644 lib/services/monitor/lib/package.json create mode 100644 lib/services/monitorManagement/package-lock.json diff --git a/lib/services/monitor/lib/LICENSE.txt b/lib/services/monitor/lib/LICENSE.txt deleted file mode 100644 index 5431ba98b9..0000000000 --- a/lib/services/monitor/lib/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -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/monitor/lib/lib/models/action.js b/lib/services/monitor/lib/lib/models/action.js deleted file mode 100644 index 91eaf1b94d..0000000000 --- a/lib/services/monitor/lib/lib/models/action.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 Action { - /** - * Create a Action. - * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] - */ - constructor() { - } - - /** - * Defines the metadata of Action - * - * @returns {object} metadata of Action - * - */ - mapper() { - return { - required: false, - serializedName: 'Action', - type: { - name: 'Composite', - className: 'Action', - 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 = Action; diff --git a/lib/services/monitor/lib/lib/models/actionGroupList.js b/lib/services/monitor/lib/lib/models/actionGroupList.js deleted file mode 100644 index 686e1c81f9..0000000000 --- a/lib/services/monitor/lib/lib/models/actionGroupList.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 list of action groups. - */ -class ActionGroupList extends Array { - /** - * Create a ActionGroupList. - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ActionGroupList - * - * @returns {object} metadata of ActionGroupList - * - */ - mapper() { - return { - required: false, - serializedName: 'ActionGroupList', - type: { - name: 'Composite', - className: 'ActionGroupList', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionGroupResourceElementType', - type: { - name: 'Composite', - className: 'ActionGroupResource' - } - } - } - } - } - } - }; - } -} - -module.exports = ActionGroupList; diff --git a/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js b/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js deleted file mode 100644 index c55155969f..0000000000 --- a/lib/services/monitor/lib/lib/models/actionGroupPatchBody.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 action group object for the body of patch operations. - * - */ -class ActionGroupPatchBody { - /** - * Create a ActionGroupPatchBody. - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its actions will - * be activated. Default value: true . - */ - constructor() { - } - - /** - * Defines the metadata of ActionGroupPatchBody - * - * @returns {object} metadata of ActionGroupPatchBody - * - */ - mapper() { - return { - required: false, - serializedName: 'ActionGroupPatchBody', - type: { - name: 'Composite', - className: 'ActionGroupPatchBody', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ActionGroupPatchBody; diff --git a/lib/services/monitor/lib/lib/models/actionGroupResource.js b/lib/services/monitor/lib/lib/models/actionGroupResource.js deleted file mode 100644 index 9a443885a8..0000000000 --- a/lib/services/monitor/lib/lib/models/actionGroupResource.js +++ /dev/null @@ -1,269 +0,0 @@ -/* - * 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'); - -/** - * An action group resource. - * - * @extends models['Resource'] - */ -class ActionGroupResource extends models['Resource'] { - /** - * Create a ActionGroupResource. - * @member {string} groupShortName The short name of the action group. This - * will be used in SMS messages. - * @member {boolean} enabled Indicates whether this action group is enabled. - * If an action group is not enabled, then none of its receivers will receive - * communications. Default value: true . - * @member {array} [emailReceivers] The list of email receivers that are part - * of this action group. - * @member {array} [smsReceivers] The list of SMS receivers that are part of - * this action group. - * @member {array} [webhookReceivers] The list of webhook receivers that are - * part of this action group. - * @member {array} [itsmReceivers] The list of ITSM receivers that are part - * of this action group. - * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers - * 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(); - } - - /** - * Defines the metadata of ActionGroupResource - * - * @returns {object} metadata of ActionGroupResource - * - */ - mapper() { - return { - required: false, - serializedName: 'ActionGroupResource', - type: { - name: 'Composite', - className: 'ActionGroupResource', - 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' - } - } - } - }, - groupShortName: { - required: true, - serializedName: 'properties.groupShortName', - constraints: { - MaxLength: 15 - }, - type: { - name: 'String' - } - }, - enabled: { - required: true, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - emailReceivers: { - required: false, - serializedName: 'properties.emailReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'EmailReceiverElementType', - type: { - name: 'Composite', - className: 'EmailReceiver' - } - } - } - }, - smsReceivers: { - required: false, - serializedName: 'properties.smsReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'SmsReceiverElementType', - type: { - name: 'Composite', - className: 'SmsReceiver' - } - } - } - }, - webhookReceivers: { - required: false, - serializedName: 'properties.webhookReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'WebhookReceiverElementType', - type: { - name: 'Composite', - className: 'WebhookReceiver' - } - } - } - }, - itsmReceivers: { - required: false, - serializedName: 'properties.itsmReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ItsmReceiverElementType', - type: { - name: 'Composite', - className: 'ItsmReceiver' - } - } - } - }, - azureAppPushReceivers: { - required: false, - serializedName: 'properties.azureAppPushReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AzureAppPushReceiverElementType', - type: { - name: 'Composite', - className: 'AzureAppPushReceiver' - } - } - } - }, - automationRunbookReceivers: { - required: false, - serializedName: 'properties.automationRunbookReceivers', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutomationRunbookReceiverElementType', - type: { - name: 'Composite', - className: 'AutomationRunbookReceiver' - } - } - } - }, - 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' - } - } - } - } - } - } - }; - } -} - -module.exports = ActionGroupResource; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js deleted file mode 100644 index 727c96320c..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertActionGroup.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 pointer to an Azure Action Group. - * - */ -class ActivityLogAlertActionGroup { - /** - * Create a ActivityLogAlertActionGroup. - * @member {string} actionGroupId The resourceId of the action group. This - * cannot be null or empty. - * @member {object} [webhookProperties] the dictionary of custom properties - * to include with the post operation. These data are appended to the webhook - * payload. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertActionGroup - * - * @returns {object} metadata of ActivityLogAlertActionGroup - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertActionGroup', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionGroup', - modelProperties: { - actionGroupId: { - required: true, - serializedName: 'actionGroupId', - type: { - name: 'String' - } - }, - webhookProperties: { - required: false, - serializedName: 'webhookProperties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertActionGroup; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js b/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js deleted file mode 100644 index 2de7dd16fe..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertActionList.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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'); - -/** - * A list of activity log alert actions. - * - */ -class ActivityLogAlertActionList { - /** - * Create a ActivityLogAlertActionList. - * @member {array} [actionGroups] The list of activity log alerts. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertActionList - * - * @returns {object} metadata of ActivityLogAlertActionList - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertActionList', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionList', - modelProperties: { - actionGroups: { - required: false, - serializedName: 'actionGroups', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActivityLogAlertActionGroupElementType', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionGroup' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertActionList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js deleted file mode 100644 index 234f03ce70..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertAllOfCondition.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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'); - -/** - * An Activity Log alert condition that is met when all its member conditions - * are met. - * - */ -class ActivityLogAlertAllOfCondition { - /** - * Create a ActivityLogAlertAllOfCondition. - * @member {array} allOf The list of activity log alert conditions. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertAllOfCondition - * - * @returns {object} metadata of ActivityLogAlertAllOfCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertAllOfCondition', - type: { - name: 'Composite', - className: 'ActivityLogAlertAllOfCondition', - modelProperties: { - allOf: { - required: true, - serializedName: 'allOf', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActivityLogAlertLeafConditionElementType', - type: { - name: 'Composite', - className: 'ActivityLogAlertLeafCondition' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertAllOfCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js b/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js deleted file mode 100644 index df05750642..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertLeafCondition.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 Activity Log alert condition that is met by comparing an activity log - * field and value. - * - */ -class ActivityLogAlertLeafCondition { - /** - * Create a ActivityLogAlertLeafCondition. - * @member {string} field The name of the field that this condition will - * examine. The possible values for this field are (case-insensitive): - * 'resourceId', 'category', 'caller', 'level', 'operationName', - * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', - * 'resourceType', or anything beginning with 'properties.'. - * @member {string} equals The field value will be compared to this value - * (case-insensitive) to determine if the condition is met. - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertLeafCondition - * - * @returns {object} metadata of ActivityLogAlertLeafCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertLeafCondition', - type: { - name: 'Composite', - className: 'ActivityLogAlertLeafCondition', - modelProperties: { - field: { - required: true, - serializedName: 'field', - type: { - name: 'String' - } - }, - equals: { - required: true, - serializedName: 'equals', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertLeafCondition; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertList.js b/lib/services/monitor/lib/lib/models/activityLogAlertList.js deleted file mode 100644 index 6379f702f8..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertList.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 list of activity log alerts. - */ -class ActivityLogAlertList extends Array { - /** - * Create a ActivityLogAlertList. - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ActivityLogAlertList - * - * @returns {object} metadata of ActivityLogAlertList - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertList', - type: { - name: 'Composite', - className: 'ActivityLogAlertList', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActivityLogAlertResourceElementType', - type: { - name: 'Composite', - className: 'ActivityLogAlertResource' - } - } - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertList; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js b/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js deleted file mode 100644 index aa120768da..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertPatchBody.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 activity log alert object for the body of patch operations. - * - */ -class ActivityLogAlertPatchBody { - /** - * Create a ActivityLogAlertPatchBody. - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - */ - constructor() { - } - - /** - * Defines the metadata of ActivityLogAlertPatchBody - * - * @returns {object} metadata of ActivityLogAlertPatchBody - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertPatchBody', - type: { - name: 'Composite', - className: 'ActivityLogAlertPatchBody', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertPatchBody; diff --git a/lib/services/monitor/lib/lib/models/activityLogAlertResource.js b/lib/services/monitor/lib/lib/models/activityLogAlertResource.js deleted file mode 100644 index dc857e34d9..0000000000 --- a/lib/services/monitor/lib/lib/models/activityLogAlertResource.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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'); - -/** - * An activity log alert resource. - * - * @extends models['Resource'] - */ -class ActivityLogAlertResource extends models['Resource'] { - /** - * Create a ActivityLogAlertResource. - * @member {array} scopes A list of resourceIds that will be used as - * prefixes. The alert will only apply to activityLogs with resourceIds that - * fall under one of these prefixes. This list must include at least one - * item. - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - * @member {object} condition The condition that will cause this alert to - * activate. - * @member {array} [condition.allOf] The list of activity log alert - * conditions. - * @member {object} actions The actions that will activate when the condition - * is met. - * @member {array} [actions.actionGroups] The list of activity log alerts. - * @member {string} [description] A description of this activity log alert. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ActivityLogAlertResource - * - * @returns {object} metadata of ActivityLogAlertResource - * - */ - mapper() { - return { - required: false, - serializedName: 'ActivityLogAlertResource', - type: { - name: 'Composite', - className: 'ActivityLogAlertResource', - 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' - } - } - } - }, - scopes: { - required: true, - serializedName: 'properties.scopes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - condition: { - required: true, - serializedName: 'properties.condition', - type: { - name: 'Composite', - className: 'ActivityLogAlertAllOfCondition' - } - }, - actions: { - required: true, - serializedName: 'properties.actions', - type: { - name: 'Composite', - className: 'ActivityLogAlertActionList' - } - }, - description: { - required: false, - serializedName: 'properties.description', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ActivityLogAlertResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResource.js b/lib/services/monitor/lib/lib/models/alertRuleResource.js deleted file mode 100644 index 40978cb847..0000000000 --- a/lib/services/monitor/lib/lib/models/alertRuleResource.js +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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 alert rule resource. - * - * @extends models['Resource'] - */ -class AlertRuleResource extends models['Resource'] { - /** - * Create a AlertRuleResource. - * @member {string} alertRuleResourceName the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property - * cannot be updated for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic - * Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AlertRuleResource - * - * @returns {object} metadata of AlertRuleResource - * - */ - mapper() { - return { - required: false, - serializedName: 'AlertRuleResource', - type: { - name: 'Composite', - className: 'AlertRuleResource', - 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' - } - } - } - }, - alertRuleResourceName: { - required: true, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - description: { - required: false, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - isEnabled: { - required: true, - serializedName: 'properties.isEnabled', - type: { - name: 'Boolean' - } - }, - condition: { - required: true, - serializedName: 'properties.condition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'RuleCondition' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'RuleActionElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleAction' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = AlertRuleResource; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js b/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js deleted file mode 100644 index 40dd02b71e..0000000000 --- a/lib/services/monitor/lib/lib/models/alertRuleResourceCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 alert rule resources. - */ -class AlertRuleResourceCollection extends Array { - /** - * Create a AlertRuleResourceCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AlertRuleResourceCollection - * - * @returns {object} metadata of AlertRuleResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'AlertRuleResourceCollection', - type: { - name: 'Composite', - className: 'AlertRuleResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AlertRuleResourceElementType', - type: { - name: 'Composite', - className: 'AlertRuleResource' - } - } - } - } - } - } - }; - } -} - -module.exports = AlertRuleResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js b/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js deleted file mode 100644 index 3094d95d8b..0000000000 --- a/lib/services/monitor/lib/lib/models/alertRuleResourcePatch.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 alert rule object for patch operations. - * - */ -class AlertRuleResourcePatch { - /** - * Create a AlertRuleResourcePatch. - * @member {object} [tags] Resource tags - * @member {string} name the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property - * cannot be updated for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic - * Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - } - - /** - * Defines the metadata of AlertRuleResourcePatch - * - * @returns {object} metadata of AlertRuleResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'AlertRuleResourcePatch', - type: { - name: 'Composite', - className: 'AlertRuleResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - name: { - required: true, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - description: { - required: false, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - isEnabled: { - required: true, - serializedName: 'properties.isEnabled', - type: { - name: 'Boolean' - } - }, - condition: { - required: true, - serializedName: 'properties.condition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'RuleCondition' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'RuleActionElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleAction' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = AlertRuleResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js b/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js deleted file mode 100644 index b54ae4d250..0000000000 --- a/lib/services/monitor/lib/lib/models/automationRunbookReceiver.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 Azure Automation Runbook notification receiver. - * - */ -class AutomationRunbookReceiver { - /** - * Create a AutomationRunbookReceiver. - * @member {string} automationAccountId The Azure automation account Id which - * holds this runbook and authenticate to Azure resource. - * @member {string} runbookName The name for this runbook. - * @member {string} webhookResourceId The resource id for webhook linked to - * this runbook. - * @member {boolean} isGlobalRunbook Indicates whether this instance is - * global runbook. - * @member {string} [name] Indicates name of the webhook. - * @member {string} [serviceUri] The URI where webhooks should be sent. - */ - constructor() { - } - - /** - * Defines the metadata of AutomationRunbookReceiver - * - * @returns {object} metadata of AutomationRunbookReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'AutomationRunbookReceiver', - type: { - name: 'Composite', - className: 'AutomationRunbookReceiver', - modelProperties: { - automationAccountId: { - required: true, - serializedName: 'automationAccountId', - type: { - name: 'String' - } - }, - runbookName: { - required: true, - serializedName: 'runbookName', - type: { - name: 'String' - } - }, - webhookResourceId: { - required: true, - serializedName: 'webhookResourceId', - type: { - name: 'String' - } - }, - isGlobalRunbook: { - required: true, - serializedName: 'isGlobalRunbook', - type: { - name: 'Boolean' - } - }, - name: { - required: false, - serializedName: 'name', - type: { - name: 'String' - } - }, - serviceUri: { - required: false, - serializedName: 'serviceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutomationRunbookReceiver; diff --git a/lib/services/monitor/lib/lib/models/autoscaleNotification.js b/lib/services/monitor/lib/lib/models/autoscaleNotification.js deleted file mode 100644 index d56fcbc701..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleNotification.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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'); - -/** - * Autoscale notification. - * - */ -class AutoscaleNotification { - /** - * Create a AutoscaleNotification. - * @member {object} [email] the email notification. - * @member {boolean} [email.sendToSubscriptionAdministrator] a value - * indicating whether to send email to subscription administrator. - * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value - * indicating whether to send email to subscription co-administrators. - * @member {array} [email.customEmails] the custom e-mails list. This value - * can be null or empty, in which case this attribute will be ignored. - * @member {array} [webhooks] the collection of webhook notifications. - */ - constructor() { - } - - /** - * Defines the metadata of AutoscaleNotification - * - * @returns {object} metadata of AutoscaleNotification - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleNotification', - type: { - name: 'Composite', - className: 'AutoscaleNotification', - modelProperties: { - operation: { - required: true, - isConstant: true, - serializedName: 'operation', - defaultValue: 'Scale', - type: { - name: 'String' - } - }, - email: { - required: false, - serializedName: 'email', - type: { - name: 'Composite', - className: 'EmailNotification' - } - }, - webhooks: { - required: false, - serializedName: 'webhooks', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'WebhookNotificationElementType', - type: { - name: 'Composite', - className: 'WebhookNotification' - } - } - } - } - } - } - }; - } -} - -module.exports = AutoscaleNotification; diff --git a/lib/services/monitor/lib/lib/models/autoscaleProfile.js b/lib/services/monitor/lib/lib/models/autoscaleProfile.js deleted file mode 100644 index a26c7a898f..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleProfile.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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'); - -/** - * Autoscale profile. - * - */ -class AutoscaleProfile { - /** - * Create a AutoscaleProfile. - * @member {string} name the name of the profile. - * @member {object} capacity the number of instances that can be used during - * this profile. - * @member {string} [capacity.minimum] the minimum number of instances for - * the resource. - * @member {string} [capacity.maximum] the maximum number of instances for - * the resource. The actual maximum number of instances is limited by the - * cores that are available in the subscription. - * @member {string} [capacity.default] the number of instances that will be - * set if metrics are not available for evaluation. The default is only used - * if the current instance count is lower than the default. - * @member {array} rules the collection of rules that provide the triggers - * and parameters for the scaling action. A maximum of 10 rules can be - * specified. - * @member {object} [fixedDate] the specific date-time for the profile. This - * element is not used if the Recurrence element is used. - * @member {string} [fixedDate.timeZone] the timezone of the start and end - * times for the profile. Some examples of valid timezones are: Dateline - * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain - * Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, - * Central America Standard Time, Central Standard Time, Central Standard - * Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, - * Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, - * Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard - * Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland - * Standard Time, E. South America Standard Time, Argentina Standard Time, SA - * Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, - * Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard - * Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard - * Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe - * Standard Time, Romance Standard Time, Central European Standard Time, W. - * Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, - * GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria - * Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE - * Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad - * Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard - * Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard - * Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, - * Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, - * Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard - * Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard - * Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard - * Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar - * Standard Time, SE Asia Standard Time, North Asia Standard Time, China - * Standard Time, North Asia East Standard Time, Singapore Standard Time, W. - * Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia - * Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New - * Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard - * Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {date} [fixedDate.start] the start time for the profile in ISO - * 8601 format. - * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 - * 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 - * of the profile. Some examples of valid timezones are: Dateline Standard - * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - * Mountain Standard Time (Mexico), Mountain Standard Time, Central America - * Standard Time, Central Standard Time, Central Standard Time (Mexico), - * Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard - * Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard - * Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western - * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. - * South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [recurrence.schedule.days] the collection of days that the - * profile takes effect on. Possible values are Sunday through Saturday. - * @member {array} [recurrence.schedule.hours] A collection of hours that the - * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock - * (AM/PM times are not supported). - * @member {array} [recurrence.schedule.minutes] A collection of minutes at - * which the profile takes effect at. - */ - constructor() { - } - - /** - * Defines the metadata of AutoscaleProfile - * - * @returns {object} metadata of AutoscaleProfile - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleProfile', - type: { - name: 'Composite', - className: 'AutoscaleProfile', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - capacity: { - required: true, - serializedName: 'capacity', - type: { - name: 'Composite', - className: 'ScaleCapacity' - } - }, - rules: { - required: true, - serializedName: 'rules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ScaleRuleElementType', - type: { - name: 'Composite', - className: 'ScaleRule' - } - } - } - }, - fixedDate: { - required: false, - serializedName: 'fixedDate', - type: { - name: 'Composite', - className: 'TimeWindow' - } - }, - recurrence: { - required: false, - serializedName: 'recurrence', - type: { - name: 'Composite', - className: 'Recurrence' - } - } - } - } - }; - } -} - -module.exports = AutoscaleProfile; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js deleted file mode 100644 index d5363c2f72..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleSettingResource.js +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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 autoscale setting resource. - * - * @extends models['Resource'] - */ -class AutoscaleSettingResource extends models['Resource'] { - /** - * Create a AutoscaleSettingResource. - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [autoscaleSettingResourceName] the name of the autoscale - * setting. - * @member {string} [targetResourceUri] the resource identifier of the - * resource that the autoscale setting should be added to. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AutoscaleSettingResource - * - * @returns {object} metadata of AutoscaleSettingResource - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleSettingResource', - type: { - name: 'Composite', - className: 'AutoscaleSettingResource', - 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' - } - } - } - }, - profiles: { - required: true, - serializedName: 'properties.profiles', - constraints: { - MaxItems: 20 - }, - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleProfileElementType', - type: { - name: 'Composite', - className: 'AutoscaleProfile' - } - } - } - }, - notifications: { - required: false, - serializedName: 'properties.notifications', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleNotificationElementType', - type: { - name: 'Composite', - className: 'AutoscaleNotification' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - autoscaleSettingResourceName: { - required: false, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - targetResourceUri: { - required: false, - serializedName: 'properties.targetResourceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutoscaleSettingResource; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js deleted file mode 100644 index 0f0ca6ac53..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleSettingResourceCollection.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 autoscale setting resources. - */ -class AutoscaleSettingResourceCollection extends Array { - /** - * Create a AutoscaleSettingResourceCollection. - * @member {string} [nextLink] URL to get the next set of results. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of AutoscaleSettingResourceCollection - * - * @returns {object} metadata of AutoscaleSettingResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleSettingResourceCollection', - type: { - name: 'Composite', - className: 'AutoscaleSettingResourceCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleSettingResourceElementType', - type: { - name: 'Composite', - className: 'AutoscaleSettingResource' - } - } - } - }, - nextLink: { - required: false, - serializedName: 'nextLink', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutoscaleSettingResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js b/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js deleted file mode 100644 index fe1ac2f14a..0000000000 --- a/lib/services/monitor/lib/lib/models/autoscaleSettingResourcePatch.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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 autoscale setting object for patch operations. - * - */ -class AutoscaleSettingResourcePatch { - /** - * Create a AutoscaleSettingResourcePatch. - * @member {object} [tags] Resource tags - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [name] the name of the autoscale setting. - * @member {string} [targetResourceUri] the resource identifier of the - * resource that the autoscale setting should be added to. - */ - constructor() { - } - - /** - * Defines the metadata of AutoscaleSettingResourcePatch - * - * @returns {object} metadata of AutoscaleSettingResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'AutoscaleSettingResourcePatch', - type: { - name: 'Composite', - className: 'AutoscaleSettingResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - profiles: { - required: true, - serializedName: 'properties.profiles', - constraints: { - MaxItems: 20 - }, - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleProfileElementType', - type: { - name: 'Composite', - className: 'AutoscaleProfile' - } - } - } - }, - notifications: { - required: false, - serializedName: 'properties.notifications', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AutoscaleNotificationElementType', - type: { - name: 'Composite', - className: 'AutoscaleNotification' - } - } - } - }, - enabled: { - required: false, - serializedName: 'properties.enabled', - defaultValue: true, - type: { - name: 'Boolean' - } - }, - name: { - required: false, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - targetResourceUri: { - required: false, - serializedName: 'properties.targetResourceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AutoscaleSettingResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js b/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js deleted file mode 100644 index 0360bb90f0..0000000000 --- a/lib/services/monitor/lib/lib/models/azureAppPushReceiver.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 Azure mobile App push notification receiver. - * - */ -class AzureAppPushReceiver { - /** - * Create a AzureAppPushReceiver. - * @member {string} name The name of the Azure mobile app push receiver. - * Names must be unique across all receivers within an action group. - * @member {string} emailAddress The email address registered for the Azure - * mobile app. - */ - constructor() { - } - - /** - * Defines the metadata of AzureAppPushReceiver - * - * @returns {object} metadata of AzureAppPushReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'AzureAppPushReceiver', - type: { - name: 'Composite', - className: 'AzureAppPushReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - emailAddress: { - required: true, - serializedName: 'emailAddress', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = AzureAppPushReceiver; diff --git a/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js b/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js deleted file mode 100644 index 1252eef8a7..0000000000 --- a/lib/services/monitor/lib/lib/models/azureFunctionReceiver.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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/monitor/lib/lib/models/baseline.js b/lib/services/monitor/lib/lib/models/baseline.js deleted file mode 100644 index ffd9d6f3eb..0000000000 --- a/lib/services/monitor/lib/lib/models/baseline.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 baseline values for a single sensitivity value. - * - */ -class Baseline { - /** - * Create a Baseline. - * @member {string} sensitivity the sensitivity of the baseline. Possible - * values include: 'Low', 'Medium', 'High' - * @member {array} lowThresholds The low thresholds of the baseline. - * @member {array} highThresholds The high thresholds of the baseline. - */ - constructor() { - } - - /** - * Defines the metadata of Baseline - * - * @returns {object} metadata of Baseline - * - */ - mapper() { - return { - required: false, - serializedName: 'Baseline', - type: { - name: 'Composite', - className: 'Baseline', - modelProperties: { - sensitivity: { - required: true, - serializedName: 'sensitivity', - type: { - name: 'Enum', - allowedValues: [ 'Low', 'Medium', 'High' ] - } - }, - lowThresholds: { - required: true, - serializedName: 'lowThresholds', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - }, - highThresholds: { - required: true, - serializedName: 'highThresholds', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - } - } - } - }; - } -} - -module.exports = Baseline; diff --git a/lib/services/monitor/lib/lib/models/baselineMetadataValue.js b/lib/services/monitor/lib/lib/models/baselineMetadataValue.js deleted file mode 100644 index f0353fa4b3..0000000000 --- a/lib/services/monitor/lib/lib/models/baselineMetadataValue.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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'); - -/** - * Represents a baseline metadata value. - * - */ -class BaselineMetadataValue { - /** - * Create a BaselineMetadataValue. - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ - constructor() { - } - - /** - * Defines the metadata of BaselineMetadataValue - * - * @returns {object} metadata of BaselineMetadataValue - * - */ - mapper() { - return { - required: false, - serializedName: 'BaselineMetadataValue', - type: { - name: 'Composite', - className: 'BaselineMetadataValue', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - value: { - required: false, - serializedName: 'value', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = BaselineMetadataValue; diff --git a/lib/services/monitor/lib/lib/models/baselineResponse.js b/lib/services/monitor/lib/lib/models/baselineResponse.js deleted file mode 100644 index db9e23dd39..0000000000 --- a/lib/services/monitor/lib/lib/models/baselineResponse.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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 response to a baseline query. - * - */ -class BaselineResponse { - /** - * Create a BaselineResponse. - * @member {string} [id] the metric baseline Id. - * @member {string} [type] the resource type of the baseline resource. - * @member {object} [name] the name and the display name of the metric, i.e. - * it is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [timespan] The timespan for which the data was retrieved. - * Its value consists of two datatimes concatenated, separated by '/'. This - * may be adjusted in the future and returned back from what was originally - * requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if - * a metadata request was made. - * @member {string} [aggregation] The aggregation type of the metric. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} [baseline] the baseline values for each sensitivity. - * @member {array} [metadata] the baseline metadata values. - */ - constructor() { - } - - /** - * Defines the metadata of BaselineResponse - * - * @returns {object} metadata of BaselineResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'BaselineResponse', - type: { - name: 'Composite', - className: 'BaselineResponse', - modelProperties: { - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - type: { - required: false, - readOnly: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - timespan: { - required: false, - serializedName: 'properties.timespan', - type: { - name: 'String' - } - }, - interval: { - required: false, - serializedName: 'properties.interval', - type: { - name: 'TimeSpan' - } - }, - aggregation: { - required: false, - serializedName: 'properties.aggregation', - type: { - name: 'String' - } - }, - timestamps: { - required: false, - serializedName: 'properties.timestamps', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DateElementType', - type: { - name: 'DateTime' - } - } - } - }, - baseline: { - required: false, - serializedName: 'properties.baseline', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'BaselineElementType', - type: { - name: 'Composite', - className: 'Baseline' - } - } - } - }, - metadata: { - required: false, - serializedName: 'properties.metadata', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'BaselineMetadataValueElementType', - type: { - name: 'Composite', - className: 'BaselineMetadataValue' - } - } - } - } - } - } - }; - } -} - -module.exports = BaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js b/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js deleted file mode 100644 index 3b8328e966..0000000000 --- a/lib/services/monitor/lib/lib/models/calculateBaselineResponse.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 response to a calcualte baseline call. - * - */ -class CalculateBaselineResponse { - /** - * Create a CalculateBaselineResponse. - * @member {string} type the resource type of the baseline resource. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} baseline the baseline values for each sensitivity. - */ - constructor() { - } - - /** - * Defines the metadata of CalculateBaselineResponse - * - * @returns {object} metadata of CalculateBaselineResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'CalculateBaselineResponse', - type: { - name: 'Composite', - className: 'CalculateBaselineResponse', - modelProperties: { - type: { - required: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - timestamps: { - required: false, - serializedName: 'timestamps', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DateElementType', - type: { - name: 'DateTime' - } - } - } - }, - baseline: { - required: true, - serializedName: 'baseline', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'BaselineElementType', - type: { - name: 'Composite', - className: 'Baseline' - } - } - } - } - } - } - }; - } -} - -module.exports = CalculateBaselineResponse; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js deleted file mode 100644 index 00e2c23663..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResource.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 diagnostic settings category resource. - * - * @extends models['ProxyOnlyResource'] - */ -class DiagnosticSettingsCategoryResource extends models['ProxyOnlyResource'] { - /** - * Create a DiagnosticSettingsCategoryResource. - * @member {string} [categoryType] The type of the diagnostic settings - * category. Possible values include: 'Metrics', 'Logs' - */ - constructor() { - super(); - } - - /** - * Defines the metadata of DiagnosticSettingsCategoryResource - * - * @returns {object} metadata of DiagnosticSettingsCategoryResource - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsCategoryResource', - type: { - name: 'Composite', - className: 'DiagnosticSettingsCategoryResource', - 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' - } - }, - categoryType: { - required: false, - serializedName: 'properties.categoryType', - type: { - name: 'Enum', - allowedValues: [ 'Metrics', 'Logs' ] - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsCategoryResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js deleted file mode 100644 index 00199aec14..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsCategoryResourceCollection.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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'); - -/** - * Represents a collection of diagnostic setting category resources. - * - */ -class DiagnosticSettingsCategoryResourceCollection { - /** - * Create a DiagnosticSettingsCategoryResourceCollection. - * @member {array} [value] The collection of diagnostic settings category - * resources. - */ - constructor() { - } - - /** - * Defines the metadata of DiagnosticSettingsCategoryResourceCollection - * - * @returns {object} metadata of DiagnosticSettingsCategoryResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsCategoryResourceCollection', - type: { - name: 'Composite', - className: 'DiagnosticSettingsCategoryResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DiagnosticSettingsCategoryResourceElementType', - type: { - name: 'Composite', - className: 'DiagnosticSettingsCategoryResource' - } - } - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsCategoryResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js deleted file mode 100644 index b255747c24..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsResource.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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 diagnostic setting resource. - * - * @extends models['ProxyOnlyResource'] - */ -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} [eventHubAuthorizationRuleId] The resource Id for the - * event hub authorization rule. - * @member {string} [eventHubName] The name of the event hub. If none is - * specified, the default event hub will be selected. - * @member {array} [metrics] the list of metric settings. - * @member {array} [logs] the list of logs settings. - * @member {string} [workspaceId] The workspace ID (resource ID of a Log - * Analytics workspace) for a Log Analytics workspace to which you would like - * to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - */ - constructor() { - super(); - } - - /** - * Defines the metadata of DiagnosticSettingsResource - * - * @returns {object} metadata of DiagnosticSettingsResource - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsResource', - type: { - name: 'Composite', - className: 'DiagnosticSettingsResource', - 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' - } - }, - storageAccountId: { - required: false, - serializedName: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - eventHubAuthorizationRuleId: { - required: false, - serializedName: 'properties.eventHubAuthorizationRuleId', - type: { - name: 'String' - } - }, - eventHubName: { - required: false, - serializedName: 'properties.eventHubName', - type: { - name: 'String' - } - }, - metrics: { - required: false, - serializedName: 'properties.metrics', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricSettingsElementType', - type: { - name: 'Composite', - className: 'MetricSettings' - } - } - } - }, - logs: { - required: false, - serializedName: 'properties.logs', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LogSettingsElementType', - type: { - name: 'Composite', - className: 'LogSettings' - } - } - } - }, - workspaceId: { - required: false, - serializedName: 'properties.workspaceId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsResource; diff --git a/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js b/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js deleted file mode 100644 index 89650e1336..0000000000 --- a/lib/services/monitor/lib/lib/models/diagnosticSettingsResourceCollection.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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'); - -/** - * Represents a collection of alert rule resources. - * - */ -class DiagnosticSettingsResourceCollection { - /** - * Create a DiagnosticSettingsResourceCollection. - * @member {array} [value] The collection of diagnostic settings resources;. - */ - constructor() { - } - - /** - * Defines the metadata of DiagnosticSettingsResourceCollection - * - * @returns {object} metadata of DiagnosticSettingsResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'DiagnosticSettingsResourceCollection', - type: { - name: 'Composite', - className: 'DiagnosticSettingsResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DiagnosticSettingsResourceElementType', - type: { - name: 'Composite', - className: 'DiagnosticSettingsResource' - } - } - } - } - } - } - }; - } -} - -module.exports = DiagnosticSettingsResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/emailNotification.js b/lib/services/monitor/lib/lib/models/emailNotification.js deleted file mode 100644 index c11f1b2d24..0000000000 --- a/lib/services/monitor/lib/lib/models/emailNotification.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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'; - -/** - * Email notification of an autoscale event. - * - */ -class EmailNotification { - /** - * Create a EmailNotification. - * @member {boolean} [sendToSubscriptionAdministrator] a value indicating - * whether to send email to subscription administrator. - * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating - * whether to send email to subscription co-administrators. - * @member {array} [customEmails] the custom e-mails list. This value can be - * null or empty, in which case this attribute will be ignored. - */ - constructor() { - } - - /** - * Defines the metadata of EmailNotification - * - * @returns {object} metadata of EmailNotification - * - */ - mapper() { - return { - required: false, - serializedName: 'EmailNotification', - type: { - name: 'Composite', - className: 'EmailNotification', - modelProperties: { - sendToSubscriptionAdministrator: { - required: false, - serializedName: 'sendToSubscriptionAdministrator', - type: { - name: 'Boolean' - } - }, - sendToSubscriptionCoAdministrators: { - required: false, - serializedName: 'sendToSubscriptionCoAdministrators', - type: { - name: 'Boolean' - } - }, - customEmails: { - required: false, - serializedName: 'customEmails', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = EmailNotification; diff --git a/lib/services/monitor/lib/lib/models/emailReceiver.js b/lib/services/monitor/lib/lib/models/emailReceiver.js deleted file mode 100644 index 508eac1ad4..0000000000 --- a/lib/services/monitor/lib/lib/models/emailReceiver.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 email receiver. - * - */ -class EmailReceiver { - /** - * Create a EmailReceiver. - * @member {string} name The name of the email receiver. Names must be unique - * across all receivers within an action group. - * @member {string} emailAddress The email address of this receiver. - * @member {string} [status] The receiver status of the e-mail. Possible - * values include: 'NotSpecified', 'Enabled', 'Disabled' - */ - constructor() { - } - - /** - * Defines the metadata of EmailReceiver - * - * @returns {object} metadata of EmailReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'EmailReceiver', - type: { - name: 'Composite', - className: 'EmailReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - emailAddress: { - required: true, - serializedName: 'emailAddress', - type: { - name: 'String' - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] - } - } - } - } - }; - } -} - -module.exports = EmailReceiver; diff --git a/lib/services/monitor/lib/lib/models/enableRequest.js b/lib/services/monitor/lib/lib/models/enableRequest.js deleted file mode 100644 index 886d80bc33..0000000000 --- a/lib/services/monitor/lib/lib/models/enableRequest.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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'; - -/** - * Describes a receiver that should be resubscribed. - * - */ -class EnableRequest { - /** - * Create a EnableRequest. - * @member {string} receiverName The name of the receiver to resubscribe. - */ - constructor() { - } - - /** - * Defines the metadata of EnableRequest - * - * @returns {object} metadata of EnableRequest - * - */ - mapper() { - return { - required: false, - serializedName: 'EnableRequest', - type: { - name: 'Composite', - className: 'EnableRequest', - modelProperties: { - receiverName: { - required: true, - serializedName: 'receiverName', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EnableRequest; diff --git a/lib/services/monitor/lib/lib/models/errorResponse.js b/lib/services/monitor/lib/lib/models/errorResponse.js deleted file mode 100644 index f952d62061..0000000000 --- a/lib/services/monitor/lib/lib/models/errorResponse.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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'; - -/** - * Describes the format of Error response. - * - */ -class ErrorResponse { - /** - * Create a ErrorResponse. - * @member {string} [code] Error code - * @member {string} [message] Error message indicating why the operation - * failed. - */ - constructor() { - } - - /** - * Defines the metadata of ErrorResponse - * - * @returns {object} metadata of ErrorResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'ErrorResponse', - type: { - name: 'Composite', - className: 'ErrorResponse', - modelProperties: { - code: { - required: false, - serializedName: 'code', - type: { - name: 'String' - } - }, - message: { - required: false, - serializedName: 'message', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ErrorResponse; diff --git a/lib/services/monitor/lib/lib/models/eventCategoryCollection.js b/lib/services/monitor/lib/lib/models/eventCategoryCollection.js deleted file mode 100644 index 5a8180acf9..0000000000 --- a/lib/services/monitor/lib/lib/models/eventCategoryCollection.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 collection of event categories. Currently possible values are: - * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. - */ -class EventCategoryCollection extends Array { - /** - * Create a EventCategoryCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of EventCategoryCollection - * - * @returns {object} metadata of EventCategoryCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'EventCategoryCollection', - type: { - name: 'Composite', - className: 'EventCategoryCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LocalizableStringElementType', - type: { - name: 'Composite', - className: 'LocalizableString' - } - } - } - } - } - } - }; - } -} - -module.exports = EventCategoryCollection; diff --git a/lib/services/monitor/lib/lib/models/eventData.js b/lib/services/monitor/lib/lib/models/eventData.js deleted file mode 100644 index 4e8b1c3046..0000000000 --- a/lib/services/monitor/lib/lib/models/eventData.js +++ /dev/null @@ -1,342 +0,0 @@ -/* - * 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 Azure event log entries are of type EventData - * - */ -class EventData { - /** - * Create a EventData. - * @member {object} [authorization] - * @member {string} [authorization.action] the permissible actions. For - * instance: microsoft.support/supporttickets/write - * @member {string} [authorization.role] the role of the user. For instance: - * Subscription Admin - * @member {string} [authorization.scope] the scope. - * @member {object} [claims] key value pairs to identify ARM permissions. - * @member {string} [caller] the email address of the user who has performed - * the operation, the UPN claim or SPN claim based on availability. - * @member {string} [description] the description of the event. - * @member {string} [id] the Id of this event as required by ARM for RBAC. It - * contains the EventDataID and a timestamp information. - * @member {string} [eventDataId] the event data Id. This is a unique - * identifier for an event. - * @member {string} [correlationId] the correlation Id, usually a GUID in the - * string format. The correlation Id is shared among the events that belong - * to the same uber operation. - * @member {object} [eventName] the event name. This value should not be - * confused with OperationName. For practical purposes, OperationName might - * be more appealing to end users. - * @member {string} [eventName.value] the invariant value. - * @member {string} [eventName.localizedValue] the locale specific value. - * @member {object} [category] the event category. - * @member {string} [category.value] the invariant value. - * @member {string} [category.localizedValue] the locale specific value. - * @member {object} [httpRequest] the HTTP request info. Usually includes the - * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated - * the event) and 'method' (HTTP method e.g. PUT). - * @member {string} [httpRequest.clientRequestId] the client request id. - * @member {string} [httpRequest.clientIpAddress] the client Ip Address - * @member {string} [httpRequest.method] the Http request method. - * @member {string} [httpRequest.uri] the Uri. - * @member {string} [level] the event level. Possible values include: - * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - * @member {string} [resourceGroupName] the resource group name of the - * impacted resource. - * @member {object} [resourceProviderName] the resource provider name of the - * impacted resource. - * @member {string} [resourceProviderName.value] the invariant value. - * @member {string} [resourceProviderName.localizedValue] the locale specific - * value. - * @member {string} [resourceId] the resource uri that uniquely identifies - * the resource that caused this event. - * @member {object} [resourceType] the resource type - * @member {string} [resourceType.value] the invariant value. - * @member {string} [resourceType.localizedValue] the locale specific value. - * @member {string} [operationId] It is usually a GUID shared among the - * events corresponding to single operation. This value should not be - * confused with EventName. - * @member {object} [operationName] the operation name. - * @member {string} [operationName.value] the invariant value. - * @member {string} [operationName.localizedValue] the locale specific value. - * @member {object} [properties] the set of pairs (usually a - * Dictionary) that includes details about the event. - * @member {object} [status] a string describing the status of the operation. - * Some typical values are: Started, In progress, Succeeded, Failed, - * Resolved. - * @member {string} [status.value] the invariant value. - * @member {string} [status.localizedValue] the locale specific value. - * @member {object} [subStatus] the event sub status. Most of the time, when - * included, this captures the HTTP status code of the REST call. Common - * values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), - * Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad - * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), - * Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: - * 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP - * Status Code: 504) - * @member {string} [subStatus.value] the invariant value. - * @member {string} [subStatus.localizedValue] the locale specific value. - * @member {date} [eventTimestamp] the timestamp of when the event was - * generated by the Azure service processing the request corresponding the - * event. It in ISO 8601 format. - * @member {date} [submissionTimestamp] the timestamp of when the event - * became available for querying via this API. It is in ISO 8601 format. This - * value should not be confused eventTimestamp. As there might be a delay - * between the occurrence time of the event, and the time that the event is - * submitted to the Azure logging infrastructure. - * @member {string} [subscriptionId] the Azure subscription Id usually a - * GUID. - * @member {string} [tenantId] the Azure tenant Id - */ - constructor() { - } - - /** - * Defines the metadata of EventData - * - * @returns {object} metadata of EventData - * - */ - mapper() { - return { - required: false, - serializedName: 'EventData', - type: { - name: 'Composite', - className: 'EventData', - modelProperties: { - authorization: { - required: false, - readOnly: true, - serializedName: 'authorization', - type: { - name: 'Composite', - className: 'SenderAuthorization' - } - }, - claims: { - required: false, - readOnly: true, - serializedName: 'claims', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - caller: { - required: false, - readOnly: true, - serializedName: 'caller', - type: { - name: 'String' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - eventDataId: { - required: false, - readOnly: true, - serializedName: 'eventDataId', - type: { - name: 'String' - } - }, - correlationId: { - required: false, - readOnly: true, - serializedName: 'correlationId', - type: { - name: 'String' - } - }, - eventName: { - required: false, - readOnly: true, - serializedName: 'eventName', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - category: { - required: false, - readOnly: true, - serializedName: 'category', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - httpRequest: { - required: false, - readOnly: true, - serializedName: 'httpRequest', - type: { - name: 'Composite', - className: 'HttpRequestInfo' - } - }, - level: { - required: false, - readOnly: true, - serializedName: 'level', - type: { - name: 'Enum', - allowedValues: [ 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' ] - } - }, - resourceGroupName: { - required: false, - readOnly: true, - serializedName: 'resourceGroupName', - type: { - name: 'String' - } - }, - resourceProviderName: { - required: false, - readOnly: true, - serializedName: 'resourceProviderName', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - resourceId: { - required: false, - readOnly: true, - serializedName: 'resourceId', - type: { - name: 'String' - } - }, - resourceType: { - required: false, - readOnly: true, - serializedName: 'resourceType', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - operationId: { - required: false, - readOnly: true, - serializedName: 'operationId', - type: { - name: 'String' - } - }, - operationName: { - required: false, - readOnly: true, - serializedName: 'operationName', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - properties: { - required: false, - readOnly: true, - serializedName: 'properties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - subStatus: { - required: false, - readOnly: true, - serializedName: 'subStatus', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - eventTimestamp: { - required: false, - readOnly: true, - serializedName: 'eventTimestamp', - type: { - name: 'DateTime' - } - }, - submissionTimestamp: { - required: false, - readOnly: true, - serializedName: 'submissionTimestamp', - type: { - name: 'DateTime' - } - }, - subscriptionId: { - required: false, - readOnly: true, - serializedName: 'subscriptionId', - type: { - name: 'String' - } - }, - tenantId: { - required: false, - readOnly: true, - serializedName: 'tenantId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EventData; diff --git a/lib/services/monitor/lib/lib/models/eventDataCollection.js b/lib/services/monitor/lib/lib/models/eventDataCollection.js deleted file mode 100644 index 0fe4c985c9..0000000000 --- a/lib/services/monitor/lib/lib/models/eventDataCollection.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 collection of events. - */ -class EventDataCollection extends Array { - /** - * Create a EventDataCollection. - * @member {string} [nextLink] Provides the link to retrieve the next set of - * events. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of EventDataCollection - * - * @returns {object} metadata of EventDataCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'EventDataCollection', - type: { - name: 'Composite', - className: 'EventDataCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'EventDataElementType', - type: { - name: 'Composite', - className: 'EventData' - } - } - } - }, - nextLink: { - required: false, - serializedName: 'nextLink', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EventDataCollection; diff --git a/lib/services/monitor/lib/lib/models/httpRequestInfo.js b/lib/services/monitor/lib/lib/models/httpRequestInfo.js deleted file mode 100644 index 309dc12fd0..0000000000 --- a/lib/services/monitor/lib/lib/models/httpRequestInfo.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 Http request info. - * - */ -class HttpRequestInfo { - /** - * Create a HttpRequestInfo. - * @member {string} [clientRequestId] the client request id. - * @member {string} [clientIpAddress] the client Ip Address - * @member {string} [method] the Http request method. - * @member {string} [uri] the Uri. - */ - constructor() { - } - - /** - * Defines the metadata of HttpRequestInfo - * - * @returns {object} metadata of HttpRequestInfo - * - */ - mapper() { - return { - required: false, - serializedName: 'HttpRequestInfo', - type: { - name: 'Composite', - className: 'HttpRequestInfo', - modelProperties: { - clientRequestId: { - required: false, - serializedName: 'clientRequestId', - type: { - name: 'String' - } - }, - clientIpAddress: { - required: false, - serializedName: 'clientIpAddress', - type: { - name: 'String' - } - }, - method: { - required: false, - serializedName: 'method', - type: { - name: 'String' - } - }, - uri: { - required: false, - serializedName: 'uri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = HttpRequestInfo; diff --git a/lib/services/monitor/lib/lib/models/incident.js b/lib/services/monitor/lib/lib/models/incident.js deleted file mode 100644 index a591fb7efa..0000000000 --- a/lib/services/monitor/lib/lib/models/incident.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 incident indicates the activation status of an alert rule. - * - */ -class Incident { - /** - * Create a Incident. - * @member {string} [name] Incident name. - * @member {string} [ruleName] Rule name that is associated with the - * incident. - * @member {boolean} [isActive] A boolean to indicate whether the incident is - * active or resolved. - * @member {date} [activatedTime] The time at which the incident was - * activated in ISO8601 format. - * @member {date} [resolvedTime] The time at which the incident was resolved - * in ISO8601 format. If null, it means the incident is still active. - */ - constructor() { - } - - /** - * Defines the metadata of Incident - * - * @returns {object} metadata of Incident - * - */ - mapper() { - return { - required: false, - serializedName: 'Incident', - type: { - name: 'Composite', - className: 'Incident', - modelProperties: { - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - ruleName: { - required: false, - readOnly: true, - serializedName: 'ruleName', - type: { - name: 'String' - } - }, - isActive: { - required: false, - readOnly: true, - serializedName: 'isActive', - type: { - name: 'Boolean' - } - }, - activatedTime: { - required: false, - readOnly: true, - serializedName: 'activatedTime', - type: { - name: 'DateTime' - } - }, - resolvedTime: { - required: false, - readOnly: true, - serializedName: 'resolvedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = Incident; diff --git a/lib/services/monitor/lib/lib/models/incidentListResult.js b/lib/services/monitor/lib/lib/models/incidentListResult.js deleted file mode 100644 index 968388fb50..0000000000 --- a/lib/services/monitor/lib/lib/models/incidentListResult.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 List incidents operation response. - */ -class IncidentListResult extends Array { - /** - * Create a IncidentListResult. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of IncidentListResult - * - * @returns {object} metadata of IncidentListResult - * - */ - mapper() { - return { - required: false, - serializedName: 'IncidentListResult', - type: { - name: 'Composite', - className: 'IncidentListResult', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'IncidentElementType', - type: { - name: 'Composite', - className: 'Incident' - } - } - } - } - } - } - }; - } -} - -module.exports = IncidentListResult; diff --git a/lib/services/monitor/lib/lib/models/index.d.ts b/lib/services/monitor/lib/lib/models/index.d.ts deleted file mode 100644 index 44807752fe..0000000000 --- a/lib/services/monitor/lib/lib/models/index.d.ts +++ /dev/null @@ -1,2298 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { BaseResource } from 'ms-rest-azure'; -import { CloudError } from 'ms-rest-azure'; -import * as moment from 'moment'; - -export { BaseResource } from 'ms-rest-azure'; -export { CloudError } from 'ms-rest-azure'; - - -/** - * @class - * Initializes a new instance of the Resource class. - * @constructor - * An azure resource object - * - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - * @member {string} location Resource location - * @member {object} [tags] Resource tags - */ -export interface Resource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; - location: string; - tags?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the ScaleCapacity class. - * @constructor - * The number of instances that can be used during this profile. - * - * @member {string} minimum the minimum number of instances for the resource. - * @member {string} maximum the maximum number of instances for the resource. - * The actual maximum number of instances is limited by the cores that are - * available in the subscription. - * @member {string} default the number of instances that will be set if metrics - * are not available for evaluation. The default is only used if the current - * instance count is lower than the default. - */ -export interface ScaleCapacity { - minimum: string; - maximum: string; - default: string; -} - -/** - * @class - * Initializes a new instance of the MetricTrigger class. - * @constructor - * The trigger that results in a scaling action. - * - * @member {string} metricName the name of the metric that defines what the - * rule monitors. - * @member {string} metricResourceUri the resource identifier of the resource - * the rule monitors. - * @member {moment.duration} timeGrain the granularity of metrics the rule - * monitors. Must be one of the predefined values returned from metric - * definitions for the metric. Must be between 12 hours and 1 minute. - * @member {string} statistic the metric statistic type. How the metrics from - * multiple instances are combined. Possible values include: 'Average', 'Min', - * 'Max', 'Sum' - * @member {moment.duration} timeWindow the range of time in which instance - * data is collected. This value must be greater than the delay in metric - * collection, which can vary from resource-to-resource. Must be between 12 - * hours and 5 minutes. - * @member {string} timeAggregation time aggregation type. How the data that is - * collected should be combined over time. The default value is Average. - * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' - * @member {string} operator the operator that is used to compare the metric - * data and the threshold. Possible values include: 'Equals', 'NotEquals', - * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold of the metric that triggers the - * scale action. - */ -export interface MetricTrigger { - metricName: string; - metricResourceUri: string; - timeGrain: moment.Duration; - statistic: string; - timeWindow: moment.Duration; - timeAggregation: string; - operator: string; - threshold: number; -} - -/** - * @class - * Initializes a new instance of the ScaleAction class. - * @constructor - * The parameters for the scaling action. - * - * @member {string} direction the scale direction. Whether the scaling action - * increases or decreases the number of instances. Possible values include: - * 'None', 'Increase', 'Decrease' - * @member {string} type the type of action that should occur when the scale - * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', - * 'ExactCount' - * @member {string} [value] the number of instances that are involved in the - * scaling action. This value must be 1 or greater. The default value is 1. - * Default value: '1' . - * @member {moment.duration} cooldown the amount of time to wait since the last - * scaling action before this action occurs. It must be between 1 week and 1 - * minute in ISO 8601 format. - */ -export interface ScaleAction { - direction: string; - type: string; - value?: string; - cooldown: moment.Duration; -} - -/** - * @class - * Initializes a new instance of the ScaleRule class. - * @constructor - * A rule that provide the triggers and parameters for the scaling action. - * - * @member {object} metricTrigger the trigger that results in a scaling action. - * @member {string} [metricTrigger.metricName] the name of the metric that - * defines what the rule monitors. - * @member {string} [metricTrigger.metricResourceUri] the resource identifier - * of the resource the rule monitors. - * @member {moment.duration} [metricTrigger.timeGrain] the granularity of - * metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [metricTrigger.statistic] the metric statistic type. How - * the metrics from multiple instances are combined. Possible values include: - * 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [metricTrigger.timeWindow] the range of time in - * which instance data is collected. This value must be greater than the delay - * in metric collection, which can vary from resource-to-resource. Must be - * between 12 hours and 5 minutes. - * @member {string} [metricTrigger.timeAggregation] time aggregation type. How - * the data that is collected should be combined over time. The default value - * is Average. Possible values include: 'Average', 'Minimum', 'Maximum', - * 'Total', 'Count' - * @member {string} [metricTrigger.operator] the operator that is used to - * compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [metricTrigger.threshold] the threshold of the metric that - * triggers the scale action. - * @member {object} scaleAction the parameters for the scaling action. - * @member {string} [scaleAction.direction] the scale direction. Whether the - * scaling action increases or decreases the number of instances. Possible - * values include: 'None', 'Increase', 'Decrease' - * @member {string} [scaleAction.type] the type of action that should occur - * when the scale rule fires. Possible values include: 'ChangeCount', - * 'PercentChangeCount', 'ExactCount' - * @member {string} [scaleAction.value] the number of instances that are - * involved in the scaling action. This value must be 1 or greater. The default - * value is 1. - * @member {moment.duration} [scaleAction.cooldown] the amount of time to wait - * since the last scaling action before this action occurs. It must be between - * 1 week and 1 minute in ISO 8601 format. - */ -export interface ScaleRule { - metricTrigger: MetricTrigger; - scaleAction: ScaleAction; -} - -/** - * @class - * Initializes a new instance of the TimeWindow class. - * @constructor - * A specific date-time for the profile. - * - * @member {string} [timeZone] the timezone of the start and end times for the - * profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time - * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central - * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern - * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic - * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, - * Pacific SA Standard Time, Newfoundland Standard Time, E. South America - * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, - * Central European Standard Time, W. Central Africa Standard Time, Namibia - * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, - * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic - * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard - * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, - * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, - * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, - * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, - * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central - * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {date} start the start time for the profile in ISO 8601 format. - * @member {date} end the end time for the profile in ISO 8601 format. - */ -export interface TimeWindow { - timeZone?: string; - start: Date; - end: Date; -} - -/** - * @class - * Initializes a new instance of the RecurrentSchedule class. - * @constructor - * The scheduling constraints for when the profile begins. - * - * @member {string} timeZone the timezone for the hours of the profile. Some - * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian - * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), - * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time - * (Mexico), Mountain Standard Time, Central America Standard Time, Central - * Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, - * SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, - * Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, - * Central Brazilian Standard Time, SA Western Standard Time, Pacific SA - * Standard Time, Newfoundland Standard Time, E. South America Standard Time, - * Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, - * Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard - * Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, - * UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, - * Central Europe Standard Time, Romance Standard Time, Central European - * Standard Time, W. Central Africa Standard Time, Namibia Standard Time, - * Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt - * Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa - * Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard - * Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, - * Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa - * Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan - * Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian - * Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia - * Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India - * Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia - * Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} days the collection of days that the profile takes effect - * on. Possible values are Sunday through Saturday. - * @member {array} hours A collection of hours that the profile takes effect - * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not - * supported). - * @member {array} minutes A collection of minutes at which the profile takes - * effect at. - */ -export interface RecurrentSchedule { - timeZone: string; - days: string[]; - hours: number[]; - minutes: number[]; -} - -/** - * @class - * Initializes a new instance of the Recurrence class. - * @constructor - * 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 - * profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time - * (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada Central - * Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern - * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic - * Standard Time, Central Brazilian Standard Time, SA Western Standard Time, - * Pacific SA Standard Time, Newfoundland Standard Time, E. South America - * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, - * Central European Standard Time, W. Central Africa Standard Time, Namibia - * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, - * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic - * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard - * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, - * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, - * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, - * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, - * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central - * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [schedule.days] the collection of days that the profile - * takes effect on. Possible values are Sunday through Saturday. - * @member {array} [schedule.hours] A collection of hours that the profile - * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - * times are not supported). - * @member {array} [schedule.minutes] A collection of minutes at which the - * profile takes effect at. - */ -export interface Recurrence { - frequency: string; - schedule: RecurrentSchedule; -} - -/** - * @class - * Initializes a new instance of the AutoscaleProfile class. - * @constructor - * Autoscale profile. - * - * @member {string} name the name of the profile. - * @member {object} capacity the number of instances that can be used during - * this profile. - * @member {string} [capacity.minimum] the minimum number of instances for the - * resource. - * @member {string} [capacity.maximum] the maximum number of instances for the - * resource. The actual maximum number of instances is limited by the cores - * that are available in the subscription. - * @member {string} [capacity.default] the number of instances that will be set - * if metrics are not available for evaluation. The default is only used if the - * current instance count is lower than the default. - * @member {array} rules the collection of rules that provide the triggers and - * parameters for the scaling action. A maximum of 10 rules can be specified. - * @member {object} [fixedDate] the specific date-time for the profile. This - * element is not used if the Recurrence element is used. - * @member {string} [fixedDate.timeZone] the timezone of the start and end - * times for the profile. Some examples of valid timezones are: Dateline - * Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - * Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard - * Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central - * America Standard Time, Central Standard Time, Central Standard Time - * (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern - * Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay - * Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA - * Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, - * E. South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya - * Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard - * Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, - * Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, - * Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, - * Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard - * Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, - * Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, - * N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, - * North Asia Standard Time, China Standard Time, North Asia East Standard - * Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard - * Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, - * Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard - * Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific - * Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok - * Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia - * Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, - * Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line - * Islands Standard Time - * @member {date} [fixedDate.start] the start time for the profile in ISO 8601 - * format. - * @member {date} [fixedDate.end] the end time for the profile in ISO 8601 - * 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 - * of the profile. Some examples of valid timezones are: Dateline Standard - * Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - * Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - * Mountain Standard Time (Mexico), Mountain Standard Time, Central America - * Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada - * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US - * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - * Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard - * Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America - * Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - * Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - * Europe Standard Time, Central Europe Standard Time, Romance Standard Time, - * Central European Standard Time, W. Central Africa Standard Time, Namibia - * Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - * Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, - * South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - * Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic - * Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard - * Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, - * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, - * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, - * West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, - * India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central - * Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, - * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, - * China Standard Time, North Asia East Standard Time, Singapore Standard Time, - * W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, - * Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. - * Australia Standard Time, AUS Central Standard Time, E. Australia Standard - * Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania - * Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time - * Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - * Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - * Standard Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [recurrence.schedule.days] the collection of days that the - * profile takes effect on. Possible values are Sunday through Saturday. - * @member {array} [recurrence.schedule.hours] A collection of hours that the - * profile takes effect on. Values supported are 0 to 23 on the 24-hour clock - * (AM/PM times are not supported). - * @member {array} [recurrence.schedule.minutes] A collection of minutes at - * which the profile takes effect at. - */ -export interface AutoscaleProfile { - name: string; - capacity: ScaleCapacity; - rules: ScaleRule[]; - fixedDate?: TimeWindow; - recurrence?: Recurrence; -} - -/** - * @class - * Initializes a new instance of the EmailNotification class. - * @constructor - * Email notification of an autoscale event. - * - * @member {boolean} [sendToSubscriptionAdministrator] a value indicating - * whether to send email to subscription administrator. - * @member {boolean} [sendToSubscriptionCoAdministrators] a value indicating - * whether to send email to subscription co-administrators. - * @member {array} [customEmails] the custom e-mails list. This value can be - * null or empty, in which case this attribute will be ignored. - */ -export interface EmailNotification { - sendToSubscriptionAdministrator?: boolean; - sendToSubscriptionCoAdministrators?: boolean; - customEmails?: string[]; -} - -/** - * @class - * Initializes a new instance of the WebhookNotification class. - * @constructor - * Webhook notification of an autoscale event. - * - * @member {string} [serviceUri] the service address to receive the - * notification. - * @member {object} [properties] a property bag of settings. This value can be - * empty. - */ -export interface WebhookNotification { - serviceUri?: string; - properties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the AutoscaleNotification class. - * @constructor - * Autoscale notification. - * - * @member {object} [email] the email notification. - * @member {boolean} [email.sendToSubscriptionAdministrator] a value indicating - * whether to send email to subscription administrator. - * @member {boolean} [email.sendToSubscriptionCoAdministrators] a value - * indicating whether to send email to subscription co-administrators. - * @member {array} [email.customEmails] the custom e-mails list. This value can - * be null or empty, in which case this attribute will be ignored. - * @member {array} [webhooks] the collection of webhook notifications. - */ -export interface AutoscaleNotification { - email?: EmailNotification; - webhooks?: WebhookNotification[]; -} - -/** - * @class - * Initializes a new instance of the AutoscaleSettingResource class. - * @constructor - * The autoscale setting resource. - * - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [autoscaleSettingResourceName] the name of the autoscale - * setting. - * @member {string} [targetResourceUri] the resource identifier of the resource - * that the autoscale setting should be added to. - */ -export interface AutoscaleSettingResource extends Resource { - profiles: AutoscaleProfile[]; - notifications?: AutoscaleNotification[]; - enabled?: boolean; - autoscaleSettingResourceName?: string; - targetResourceUri?: string; -} - -/** - * @class - * Initializes a new instance of the AutoscaleSettingResourcePatch class. - * @constructor - * The autoscale setting object for patch operations. - * - * @member {object} [tags] Resource tags - * @member {array} profiles the collection of automatic scaling profiles that - * specify different scaling parameters for different time periods. A maximum - * of 20 profiles can be specified. - * @member {array} [notifications] the collection of notifications. - * @member {boolean} [enabled] the enabled flag. Specifies whether automatic - * scaling is enabled for the resource. The default value is 'true'. Default - * value: true . - * @member {string} [name] the name of the autoscale setting. - * @member {string} [targetResourceUri] the resource identifier of the resource - * that the autoscale setting should be added to. - */ -export interface AutoscaleSettingResourcePatch { - tags?: { [propertyName: string]: string }; - profiles: AutoscaleProfile[]; - notifications?: AutoscaleNotification[]; - enabled?: boolean; - name?: string; - targetResourceUri?: string; -} - -/** - * @class - * Initializes a new instance of the ErrorResponse class. - * @constructor - * Describes the format of Error response. - * - * @member {string} [code] Error code - * @member {string} [message] Error message indicating why the operation - * failed. - */ -export interface ErrorResponse { - code?: string; - message?: string; -} - -/** - * @class - * Initializes a new instance of the OperationDisplay class. - * @constructor - * Display metadata associated with the operation. - * - * @member {string} [provider] Service provider: Microsoft.Insights - * @member {string} [resource] Resource on which the operation is performed: - * AlertRules, Autoscale, etc. - * @member {string} [operation] Operation type: Read, write, delete, etc. - */ -export interface OperationDisplay { - provider?: string; - resource?: string; - operation?: string; -} - -/** - * @class - * Initializes a new instance of the Operation class. - * @constructor - * Microsoft Insights API operation definition. - * - * @member {string} [name] Operation name: {provider}/{resource}/{operation} - * @member {object} [display] Display metadata associated with the operation. - * @member {string} [display.provider] Service provider: Microsoft.Insights - * @member {string} [display.resource] Resource on which the operation is - * performed: AlertRules, Autoscale, etc. - * @member {string} [display.operation] Operation type: Read, write, delete, - * etc. - */ -export interface Operation { - name?: string; - display?: OperationDisplay; -} - -/** - * @class - * Initializes a new instance of the OperationListResult class. - * @constructor - * Result of the request to list Microsoft.Insights operations. It contains a - * list of operations and a URL link to get the next set of results. - * - * @member {array} [value] List of operations supported by the - * Microsoft.Insights provider. - * @member {string} [nextLink] URL to get the next set of operation list - * results if there are any. - */ -export interface OperationListResult { - value?: Operation[]; - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the Incident class. - * @constructor - * An alert incident indicates the activation status of an alert rule. - * - * @member {string} [name] Incident name. - * @member {string} [ruleName] Rule name that is associated with the incident. - * @member {boolean} [isActive] A boolean to indicate whether the incident is - * active or resolved. - * @member {date} [activatedTime] The time at which the incident was activated - * in ISO8601 format. - * @member {date} [resolvedTime] The time at which the incident was resolved in - * ISO8601 format. If null, it means the incident is still active. - */ -export interface Incident { - readonly name?: string; - readonly ruleName?: string; - readonly isActive?: boolean; - readonly activatedTime?: Date; - readonly resolvedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the RuleDataSource class. - * @constructor - * The resource from which the rule collects its data. - * - * @member {string} [resourceUri] the resource identifier of the resource the - * rule monitors. **NOTE**: this property cannot be updated for an existing - * rule. - * @member {string} odatatype Polymorphic Discriminator - */ -export interface RuleDataSource { - resourceUri?: string; - odatatype: string; -} - -/** - * @class - * Initializes a new instance of the RuleCondition class. - * @constructor - * The condition that results in the alert rule being activated. - * - * @member {object} [dataSource] the resource from which the rule collects its - * data. For this type dataSource will always be of type RuleMetricDataSource. - * @member {string} [dataSource.resourceUri] the resource identifier of the - * resource the rule monitors. **NOTE**: this property cannot be updated for an - * existing rule. - * @member {string} [dataSource.odatatype] Polymorphic Discriminator - * @member {string} odatatype Polymorphic Discriminator - */ -export interface RuleCondition { - dataSource?: RuleDataSource; - odatatype: string; -} - -/** - * @class - * Initializes a new instance of the RuleMetricDataSource class. - * @constructor - * A rule metric data source. The discriminator value is always - * RuleMetricDataSource in this case. - * - * @member {string} [metricName] the name of the metric that defines what the - * rule monitors. - */ -export interface RuleMetricDataSource extends RuleDataSource { - metricName?: string; -} - -/** - * @class - * Initializes a new instance of the RuleManagementEventClaimsDataSource class. - * @constructor - * The claims for a rule management event data source. - * - * @member {string} [emailAddress] the email address. - */ -export interface RuleManagementEventClaimsDataSource { - emailAddress?: string; -} - -/** - * @class - * Initializes a new instance of the RuleManagementEventDataSource class. - * @constructor - * A rule management event data source. The discriminator fields is always - * RuleManagementEventDataSource in this case. - * - * @member {string} [eventName] the event name. - * @member {string} [eventSource] the event source. - * @member {string} [level] the level. - * @member {string} [operationName] The name of the operation that should be - * checked for. If no name is provided, any operation will match. - * @member {string} [resourceGroupName] the resource group name. - * @member {string} [resourceProviderName] the resource provider name. - * @member {string} [status] The status of the operation that should be checked - * for. If no status is provided, any status will match. - * @member {string} [subStatus] the substatus. - * @member {object} [claims] the claims. - * @member {string} [claims.emailAddress] the email address. - */ -export interface RuleManagementEventDataSource extends RuleDataSource { - eventName?: string; - eventSource?: string; - level?: string; - operationName?: string; - resourceGroupName?: string; - resourceProviderName?: string; - status?: string; - subStatus?: string; - claims?: RuleManagementEventClaimsDataSource; -} - -/** - * @class - * Initializes a new instance of the ThresholdRuleCondition class. - * @constructor - * A rule condition based on a metric crossing a threshold. - * - * @member {string} operator the operator used to compare the data and the - * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', - * 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {string} [timeAggregation] the time aggregation operator. How the - * data that are collected should be combined over time. The default value is - * the PrimaryAggregationType of the Metric. Possible values include: - * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' - */ -export interface ThresholdRuleCondition extends RuleCondition { - operator: string; - threshold: number; - windowSize?: moment.Duration; - timeAggregation?: string; -} - -/** - * @class - * Initializes a new instance of the LocationThresholdRuleCondition class. - * @constructor - * A rule condition based on a certain number of locations failing. - * - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {number} failedLocationCount the number of locations that must fail - * to activate the alert. - */ -export interface LocationThresholdRuleCondition extends RuleCondition { - windowSize?: moment.Duration; - failedLocationCount: number; -} - -/** - * @class - * Initializes a new instance of the ManagementEventAggregationCondition class. - * @constructor - * How the data that is collected should be combined over time. - * - * @member {string} [operator] the condition operator. Possible values include: - * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - * @member {number} [threshold] The threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - */ -export interface ManagementEventAggregationCondition { - operator?: string; - threshold?: number; - windowSize?: moment.Duration; -} - -/** - * @class - * Initializes a new instance of the ManagementEventRuleCondition class. - * @constructor - * A management event rule condition. - * - * @member {object} [aggregation] How the data that is collected should be - * combined over time and when the alert is activated. Note that for management - * event alerts aggregation is optional – if it is not provided then any event - * will cause the alert to activate. - * @member {string} [aggregation.operator] the condition operator. Possible - * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [aggregation.threshold] The threshold value that activates - * the alert. - * @member {moment.duration} [aggregation.windowSize] the period of time (in - * ISO 8601 duration format) that is used to monitor alert activity based on - * the threshold. If specified then it must be between 5 minutes and 1 day. - */ -export interface ManagementEventRuleCondition extends RuleCondition { - aggregation?: ManagementEventAggregationCondition; -} - -/** - * @class - * Initializes a new instance of the RuleAction class. - * @constructor - * The action that is performed when the alert rule becomes active, and when an - * alert condition is resolved. - * - * @member {string} odatatype Polymorphic Discriminator - */ -export interface RuleAction { - odatatype: string; -} - -/** - * @class - * Initializes a new instance of the RuleEmailAction class. - * @constructor - * Specifies the action to send email when the rule condition is evaluated. The - * discriminator is always RuleEmailAction in this case. - * - * @member {boolean} [sendToServiceOwners] Whether the administrators (service - * and co-administrators) of the service should be notified when the alert is - * activated. - * @member {array} [customEmails] the list of administrator's custom email - * addresses to notify of the activation of the alert. - */ -export interface RuleEmailAction extends RuleAction { - sendToServiceOwners?: boolean; - customEmails?: string[]; -} - -/** - * @class - * Initializes a new instance of the RuleWebhookAction class. - * @constructor - * Specifies the action to post to service when the rule condition is - * evaluated. The discriminator is always RuleWebhookAction in this case. - * - * @member {string} [serviceUri] the service uri to Post the notification when - * the alert activates or resolves. - * @member {object} [properties] the dictionary of custom properties to include - * with the post operation. These data are appended to the webhook payload. - */ -export interface RuleWebhookAction extends RuleAction { - serviceUri?: string; - properties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the AlertRuleResource class. - * @constructor - * The alert rule resource. - * - * @member {string} alertRuleResourceName the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource identifier - * of the resource the rule monitors. **NOTE**: this property cannot be updated - * for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface AlertRuleResource extends Resource { - alertRuleResourceName: string; - description?: string; - isEnabled: boolean; - condition: RuleCondition; - actions?: RuleAction[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the AlertRuleResourcePatch class. - * @constructor - * The alert rule object for patch operations. - * - * @member {object} [tags] Resource tags - * @member {string} name the name of the alert rule. - * @member {string} [description] the description of the alert rule that will - * be included in the alert email. - * @member {boolean} isEnabled the flag that indicates whether the alert rule - * is enabled. - * @member {object} condition the condition that results in the alert rule - * being activated. - * @member {object} [condition.dataSource] the resource from which the rule - * collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [condition.dataSource.resourceUri] the resource identifier - * of the resource the rule monitors. **NOTE**: this property cannot be updated - * for an existing rule. - * @member {string} [condition.dataSource.odatatype] Polymorphic Discriminator - * @member {string} [condition.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface AlertRuleResourcePatch { - tags?: { [propertyName: string]: string }; - name: string; - description?: string; - isEnabled: boolean; - condition: RuleCondition; - actions?: RuleAction[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the RetentionPolicy class. - * @constructor - * Specifies the retention policy for the log. - * - * @member {boolean} enabled a value indicating whether the retention policy is - * enabled. - * @member {number} days the number of days for the retention in days. A value - * of 0 will retain the events indefinitely. - */ -export interface RetentionPolicy { - enabled: boolean; - days: number; -} - -/** - * @class - * Initializes a new instance of the LogProfileResource class. - * @constructor - * The log profile resource. - * - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories are - * created as is convenient to the user. Some values are: 'Write', 'Delete', - * and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in the - * log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface LogProfileResource extends Resource { - storageAccountId?: string; - serviceBusRuleId?: string; - locations: string[]; - categories: string[]; - retentionPolicy: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the LogProfileResourcePatch class. - * @constructor - * The log profile resource for patch operations. - * - * @member {object} [tags] Resource tags - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories are - * created as is convenient to the user. Some values are: 'Write', 'Delete', - * and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in the - * log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface LogProfileResourcePatch { - tags?: { [propertyName: string]: string }; - storageAccountId?: string; - serviceBusRuleId?: string; - locations: string[]; - categories: string[]; - retentionPolicy: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the ProxyOnlyResource class. - * @constructor - * A proxy only azure resource object - * - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - */ -export interface ProxyOnlyResource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; -} - -/** - * @class - * Initializes a new instance of the MetricSettings class. - * @constructor - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular metric. - * - * @member {moment.duration} [timeGrain] the timegrain of the metric in ISO8601 - * format. - * @member {string} [category] Name of a Diagnostic Metric category for a - * resource type this setting is applied to. To obtain the list of Diagnostic - * metric categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this category is - * enabled. - * @member {object} [retentionPolicy] the retention policy for this category. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface MetricSettings { - timeGrain?: moment.Duration; - category?: string; - enabled: boolean; - retentionPolicy?: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the LogSettings class. - * @constructor - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular log. - * - * @member {string} [category] Name of a Diagnostic Log category for a resource - * type this setting is applied to. To obtain the list of Diagnostic Log - * categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this log is enabled. - * @member {object} [retentionPolicy] the retention policy for this log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the retention - * in days. A value of 0 will retain the events indefinitely. - */ -export interface LogSettings { - category?: string; - enabled: boolean; - retentionPolicy?: RetentionPolicy; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsResource class. - * @constructor - * The diagnostic setting resource. - * - * @member {string} [storageAccountId] The resource ID of the storage account - * to which you would like to send Diagnostic Logs. - * @member {string} [eventHubAuthorizationRuleId] The resource Id for the event - * hub authorization rule. - * @member {string} [eventHubName] The name of the event hub. If none is - * specified, the default event hub will be selected. - * @member {array} [metrics] the list of metric settings. - * @member {array} [logs] the list of logs settings. - * @member {string} [workspaceId] The workspace ID (resource ID of a Log - * Analytics workspace) for a Log Analytics workspace to which you would like - * to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - */ -export interface DiagnosticSettingsResource extends ProxyOnlyResource { - storageAccountId?: string; - eventHubAuthorizationRuleId?: string; - eventHubName?: string; - metrics?: MetricSettings[]; - logs?: LogSettings[]; - workspaceId?: string; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsResourceCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - * @member {array} [value] The collection of diagnostic settings resources;. - */ -export interface DiagnosticSettingsResourceCollection { - value?: DiagnosticSettingsResource[]; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsCategoryResource class. - * @constructor - * The diagnostic settings category resource. - * - * @member {string} [categoryType] The type of the diagnostic settings - * category. Possible values include: 'Metrics', 'Logs' - */ -export interface DiagnosticSettingsCategoryResource extends ProxyOnlyResource { - categoryType?: string; -} - -/** - * @class - * Initializes a new instance of the DiagnosticSettingsCategoryResourceCollection class. - * @constructor - * Represents a collection of diagnostic setting category resources. - * - * @member {array} [value] The collection of diagnostic settings category - * resources. - */ -export interface DiagnosticSettingsCategoryResourceCollection { - value?: DiagnosticSettingsCategoryResource[]; -} - -/** - * @class - * Initializes a new instance of the EmailReceiver class. - * @constructor - * An email receiver. - * - * @member {string} name The name of the email receiver. Names must be unique - * across all receivers within an action group. - * @member {string} emailAddress The email address of this receiver. - * @member {string} [status] The receiver status of the e-mail. Possible values - * include: 'NotSpecified', 'Enabled', 'Disabled' - */ -export interface EmailReceiver { - name: string; - emailAddress: string; - readonly status?: string; -} - -/** - * @class - * Initializes a new instance of the SmsReceiver class. - * @constructor - * An SMS receiver. - * - * @member {string} name The name of the SMS receiver. Names must be unique - * across all receivers within an action group. - * @member {string} countryCode The country code of the SMS receiver. - * @member {string} phoneNumber The phone number of the SMS receiver. - * @member {string} [status] The status of the receiver. Possible values - * include: 'NotSpecified', 'Enabled', 'Disabled' - */ -export interface SmsReceiver { - name: string; - countryCode: string; - phoneNumber: string; - readonly status?: string; -} - -/** - * @class - * Initializes a new instance of the WebhookReceiver class. - * @constructor - * A webhook receiver. - * - * @member {string} name The name of the webhook receiver. Names must be unique - * across all receivers within an action group. - * @member {string} serviceUri The URI where webhooks should be sent. - */ -export interface WebhookReceiver { - name: string; - serviceUri: string; -} - -/** - * @class - * Initializes a new instance of the ItsmReceiver class. - * @constructor - * An Itsm receiver. - * - * @member {string} name The name of the Itsm receiver. Names must be unique - * across all receivers within an action group. - * @member {string} workspaceId OMS LA instance identifier. - * @member {string} connectionId Unique identification of ITSM connection among - * multiple defined in above workspace. - * @member {string} ticketConfiguration JSON blob for the configurations of the - * ITSM action. CreateMultipleWorkItems option will be part of this blob as - * well. - * @member {string} region Region in which workspace resides. Supported - * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - */ -export interface ItsmReceiver { - name: string; - workspaceId: string; - connectionId: string; - ticketConfiguration: string; - region: string; -} - -/** - * @class - * Initializes a new instance of the AzureAppPushReceiver class. - * @constructor - * The Azure mobile App push notification receiver. - * - * @member {string} name The name of the Azure mobile app push receiver. Names - * must be unique across all receivers within an action group. - * @member {string} emailAddress The email address registered for the Azure - * mobile app. - */ -export interface AzureAppPushReceiver { - name: string; - emailAddress: string; -} - -/** - * @class - * Initializes a new instance of the AutomationRunbookReceiver class. - * @constructor - * The Azure Automation Runbook notification receiver. - * - * @member {string} automationAccountId The Azure automation account Id which - * holds this runbook and authenticate to Azure resource. - * @member {string} runbookName The name for this runbook. - * @member {string} webhookResourceId The resource id for webhook linked to - * this runbook. - * @member {boolean} isGlobalRunbook Indicates whether this instance is global - * runbook. - * @member {string} [name] Indicates name of the webhook. - * @member {string} [serviceUri] The URI where webhooks should be sent. - */ -export interface AutomationRunbookReceiver { - automationAccountId: string; - runbookName: string; - webhookResourceId: string; - isGlobalRunbook: boolean; - name?: string; - 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. - * @constructor - * An action group resource. - * - * @member {string} groupShortName The short name of the action group. This - * will be used in SMS messages. - * @member {boolean} enabled Indicates whether this action group is enabled. If - * an action group is not enabled, then none of its receivers will receive - * communications. Default value: true . - * @member {array} [emailReceivers] The list of email receivers that are part - * of this action group. - * @member {array} [smsReceivers] The list of SMS receivers that are part of - * this action group. - * @member {array} [webhookReceivers] The list of webhook receivers that are - * part of this action group. - * @member {array} [itsmReceivers] The list of ITSM receivers that are part of - * this action group. - * @member {array} [azureAppPushReceivers] The list of AzureAppPush receivers - * 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; - enabled: boolean; - emailReceivers?: EmailReceiver[]; - smsReceivers?: SmsReceiver[]; - webhookReceivers?: WebhookReceiver[]; - itsmReceivers?: ItsmReceiver[]; - azureAppPushReceivers?: AzureAppPushReceiver[]; - automationRunbookReceivers?: AutomationRunbookReceiver[]; - voiceReceivers?: VoiceReceiver[]; - logicAppReceivers?: LogicAppReceiver[]; - azureFunctionReceivers?: AzureFunctionReceiver[]; -} - -/** - * @class - * Initializes a new instance of the EnableRequest class. - * @constructor - * Describes a receiver that should be resubscribed. - * - * @member {string} receiverName The name of the receiver to resubscribe. - */ -export interface EnableRequest { - receiverName: string; -} - -/** - * @class - * Initializes a new instance of the ActionGroupPatchBody class. - * @constructor - * An action group object for the body of patch operations. - * - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this action group is enabled. - * If an action group is not enabled, then none of its actions will be - * activated. Default value: true . - */ -export interface ActionGroupPatchBody { - tags?: { [propertyName: string]: string }; - enabled?: boolean; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertLeafCondition class. - * @constructor - * An Activity Log alert condition that is met by comparing an activity log - * field and value. - * - * @member {string} field The name of the field that this condition will - * examine. The possible values for this field are (case-insensitive): - * 'resourceId', 'category', 'caller', 'level', 'operationName', - * 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', - * or anything beginning with 'properties.'. - * @member {string} equals The field value will be compared to this value - * (case-insensitive) to determine if the condition is met. - */ -export interface ActivityLogAlertLeafCondition { - field: string; - equals: string; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertAllOfCondition class. - * @constructor - * An Activity Log alert condition that is met when all its member conditions - * are met. - * - * @member {array} allOf The list of activity log alert conditions. - */ -export interface ActivityLogAlertAllOfCondition { - allOf: ActivityLogAlertLeafCondition[]; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertActionGroup class. - * @constructor - * A pointer to an Azure Action Group. - * - * @member {string} actionGroupId The resourceId of the action group. This - * cannot be null or empty. - * @member {object} [webhookProperties] the dictionary of custom properties to - * include with the post operation. These data are appended to the webhook - * payload. - */ -export interface ActivityLogAlertActionGroup { - actionGroupId: string; - webhookProperties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertActionList class. - * @constructor - * A list of activity log alert actions. - * - * @member {array} [actionGroups] The list of activity log alerts. - */ -export interface ActivityLogAlertActionList { - actionGroups?: ActivityLogAlertActionGroup[]; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertResource class. - * @constructor - * An activity log alert resource. - * - * @member {array} scopes A list of resourceIds that will be used as prefixes. - * The alert will only apply to activityLogs with resourceIds that fall under - * one of these prefixes. This list must include at least one item. - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - * @member {object} condition The condition that will cause this alert to - * activate. - * @member {array} [condition.allOf] The list of activity log alert conditions. - * @member {object} actions The actions that will activate when the condition - * is met. - * @member {array} [actions.actionGroups] The list of activity log alerts. - * @member {string} [description] A description of this activity log alert. - */ -export interface ActivityLogAlertResource extends Resource { - scopes: string[]; - enabled?: boolean; - condition: ActivityLogAlertAllOfCondition; - actions: ActivityLogAlertActionList; - description?: string; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertPatchBody class. - * @constructor - * An activity log alert object for the body of patch operations. - * - * @member {object} [tags] Resource tags - * @member {boolean} [enabled] Indicates whether this activity log alert is - * enabled. If an activity log alert is not enabled, then none of its actions - * will be activated. Default value: true . - */ -export interface ActivityLogAlertPatchBody { - tags?: { [propertyName: string]: string }; - enabled?: boolean; -} - -/** - * @class - * Initializes a new instance of the LocalizableString class. - * @constructor - * The localizable string class. - * - * @member {string} value the invariant value. - * @member {string} [localizedValue] the locale specific value. - */ -export interface LocalizableString { - value: string; - localizedValue?: string; -} - -/** - * @class - * Initializes a new instance of the SenderAuthorization class. - * @constructor - * the authorization used by the user who has performed the operation that led - * to this event. This captures the RBAC properties of the event. These usually - * include the 'action', 'role' and the 'scope' - * - * @member {string} [action] the permissible actions. For instance: - * microsoft.support/supporttickets/write - * @member {string} [role] the role of the user. For instance: Subscription - * Admin - * @member {string} [scope] the scope. - */ -export interface SenderAuthorization { - action?: string; - role?: string; - scope?: string; -} - -/** - * @class - * Initializes a new instance of the HttpRequestInfo class. - * @constructor - * The Http request info. - * - * @member {string} [clientRequestId] the client request id. - * @member {string} [clientIpAddress] the client Ip Address - * @member {string} [method] the Http request method. - * @member {string} [uri] the Uri. - */ -export interface HttpRequestInfo { - clientRequestId?: string; - clientIpAddress?: string; - method?: string; - uri?: string; -} - -/** - * @class - * Initializes a new instance of the EventData class. - * @constructor - * The Azure event log entries are of type EventData - * - * @member {object} [authorization] - * @member {string} [authorization.action] the permissible actions. For - * instance: microsoft.support/supporttickets/write - * @member {string} [authorization.role] the role of the user. For instance: - * Subscription Admin - * @member {string} [authorization.scope] the scope. - * @member {object} [claims] key value pairs to identify ARM permissions. - * @member {string} [caller] the email address of the user who has performed - * the operation, the UPN claim or SPN claim based on availability. - * @member {string} [description] the description of the event. - * @member {string} [id] the Id of this event as required by ARM for RBAC. It - * contains the EventDataID and a timestamp information. - * @member {string} [eventDataId] the event data Id. This is a unique - * identifier for an event. - * @member {string} [correlationId] the correlation Id, usually a GUID in the - * string format. The correlation Id is shared among the events that belong to - * the same uber operation. - * @member {object} [eventName] the event name. This value should not be - * confused with OperationName. For practical purposes, OperationName might be - * more appealing to end users. - * @member {string} [eventName.value] the invariant value. - * @member {string} [eventName.localizedValue] the locale specific value. - * @member {object} [category] the event category. - * @member {string} [category.value] the invariant value. - * @member {string} [category.localizedValue] the locale specific value. - * @member {object} [httpRequest] the HTTP request info. Usually includes the - * 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated - * the event) and 'method' (HTTP method e.g. PUT). - * @member {string} [httpRequest.clientRequestId] the client request id. - * @member {string} [httpRequest.clientIpAddress] the client Ip Address - * @member {string} [httpRequest.method] the Http request method. - * @member {string} [httpRequest.uri] the Uri. - * @member {string} [level] the event level. Possible values include: - * 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - * @member {string} [resourceGroupName] the resource group name of the impacted - * resource. - * @member {object} [resourceProviderName] the resource provider name of the - * impacted resource. - * @member {string} [resourceProviderName.value] the invariant value. - * @member {string} [resourceProviderName.localizedValue] the locale specific - * value. - * @member {string} [resourceId] the resource uri that uniquely identifies the - * resource that caused this event. - * @member {object} [resourceType] the resource type - * @member {string} [resourceType.value] the invariant value. - * @member {string} [resourceType.localizedValue] the locale specific value. - * @member {string} [operationId] It is usually a GUID shared among the events - * corresponding to single operation. This value should not be confused with - * EventName. - * @member {object} [operationName] the operation name. - * @member {string} [operationName.value] the invariant value. - * @member {string} [operationName.localizedValue] the locale specific value. - * @member {object} [properties] the set of pairs (usually a - * Dictionary) that includes details about the event. - * @member {object} [status] a string describing the status of the operation. - * Some typical values are: Started, In progress, Succeeded, Failed, Resolved. - * @member {string} [status.value] the invariant value. - * @member {string} [status.localizedValue] the locale specific value. - * @member {object} [subStatus] the event sub status. Most of the time, when - * included, this captures the HTTP status code of the REST call. Common values - * are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted - * (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad - * Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict - * (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), - * Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status - * Code: 504) - * @member {string} [subStatus.value] the invariant value. - * @member {string} [subStatus.localizedValue] the locale specific value. - * @member {date} [eventTimestamp] the timestamp of when the event was - * generated by the Azure service processing the request corresponding the - * event. It in ISO 8601 format. - * @member {date} [submissionTimestamp] the timestamp of when the event became - * available for querying via this API. It is in ISO 8601 format. This value - * should not be confused eventTimestamp. As there might be a delay between the - * occurrence time of the event, and the time that the event is submitted to - * the Azure logging infrastructure. - * @member {string} [subscriptionId] the Azure subscription Id usually a GUID. - * @member {string} [tenantId] the Azure tenant Id - */ -export interface EventData { - readonly authorization?: SenderAuthorization; - readonly claims?: { [propertyName: string]: string }; - readonly caller?: string; - readonly description?: string; - readonly id?: string; - readonly eventDataId?: string; - readonly correlationId?: string; - readonly eventName?: LocalizableString; - readonly category?: LocalizableString; - readonly httpRequest?: HttpRequestInfo; - readonly level?: string; - readonly resourceGroupName?: string; - readonly resourceProviderName?: LocalizableString; - readonly resourceId?: string; - readonly resourceType?: LocalizableString; - readonly operationId?: string; - readonly operationName?: LocalizableString; - readonly properties?: { [propertyName: string]: string }; - readonly status?: LocalizableString; - readonly subStatus?: LocalizableString; - readonly eventTimestamp?: Date; - readonly submissionTimestamp?: Date; - readonly subscriptionId?: string; - readonly tenantId?: string; -} - -/** - * @class - * Initializes a new instance of the MetricAvailability class. - * @constructor - * Metric availability specifies the time grain (aggregation interval or - * frequency) and the retention period for that time grain. - * - * @member {moment.duration} [timeGrain] the time grain specifies the - * aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', - * etc. - * @member {moment.duration} [retention] the retention period for the metric at - * the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - */ -export interface MetricAvailability { - timeGrain?: moment.Duration; - retention?: moment.Duration; -} - -/** - * @class - * Initializes a new instance of the MetricDefinition class. - * @constructor - * Metric definition class specifies the metadata for a metric. - * - * @member {boolean} [isDimensionRequired] Flag to indicate whether the - * dimension is required. - * @member {string} [resourceId] the resource identifier of the resource that - * emitted the metric. - * @member {string} [namespace] the namespace the metric blongs to. - * @member {object} [name] the name and the display name of the metric, i.e. it - * is a localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [unit] the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', - * 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {string} [primaryAggregationType] the primary aggregation type value - * defining how to use the values for display. Possible values include: 'None', - * 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - * @member {array} [supportedAggregationTypes] the collection of what - * aggregation types are supported. - * @member {array} [metricAvailabilities] the collection of what aggregation - * intervals are available to be queried. - * @member {string} [id] the resource identifier of the metric definition. - * @member {array} [dimensions] the name and the display name of the dimension, - * i.e. it is a localizable string. - */ -export interface MetricDefinition { - isDimensionRequired?: boolean; - resourceId?: string; - namespace?: string; - name?: LocalizableString; - unit?: string; - primaryAggregationType?: string; - supportedAggregationTypes?: string[]; - metricAvailabilities?: MetricAvailability[]; - id?: string; - dimensions?: LocalizableString[]; -} - -/** - * @class - * Initializes a new instance of the MetricValue class. - * @constructor - * Represents a metric value. - * - * @member {date} timeStamp the timestamp for the metric value in ISO 8601 - * format. - * @member {number} [average] the average value in the time range. - * @member {number} [minimum] the least value in the time range. - * @member {number} [maximum] the greatest value in the time range. - * @member {number} [total] the sum of all of the values in the time range. - * @member {number} [count] the number of samples in the time range. Can be - * used to determine the number of values that contributed to the average - * value. - */ -export interface MetricValue { - timeStamp: Date; - average?: number; - minimum?: number; - maximum?: number; - total?: number; - count?: number; -} - -/** - * @class - * Initializes a new instance of the MetadataValue class. - * @constructor - * Represents a metric metadata value. - * - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ -export interface MetadataValue { - name?: LocalizableString; - value?: string; -} - -/** - * @class - * Initializes a new instance of the TimeSeriesElement class. - * @constructor - * A time series result type. The discriminator value is always TimeSeries in - * this case. - * - * @member {array} [metadatavalues] the metadata values returned if $filter was - * specified in the call. - * @member {array} [data] An array of data points representing the metric - * values. This is only returned if a result type of data is specified. - */ -export interface TimeSeriesElement { - metadatavalues?: MetadataValue[]; - data?: MetricValue[]; -} - -/** - * @class - * Initializes a new instance of the Metric class. - * @constructor - * The result data of a query. - * - * @member {string} id the metric Id. - * @member {string} type the resource type of the metric resource. - * @member {object} name the name and the display name of the metric, i.e. it - * is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} unit the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', - * 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {array} timeseries the time series returned when a data query is - * performed. - */ -export interface Metric { - id: string; - type: string; - name: LocalizableString; - unit: string; - timeseries: TimeSeriesElement[]; -} - -/** - * @class - * Initializes a new instance of the Response class. - * @constructor - * The response to a metrics query. - * - * @member {number} [cost] The integer value representing the cost of the - * query, for data case. - * @member {string} timespan The timespan for which the data was retrieved. Its - * value consists of two datatimes concatenated, separated by '/'. This may be - * adjusted in the future and returned back from what was originally requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if a - * metadata request was made. - * @member {string} [namespace] The namespace of the metrics been queried - * @member {string} [resourceregion] The region of the resource been queried - * for metrics. - * @member {array} value the value of the collection. - */ -export interface Response { - cost?: number; - timespan: string; - interval?: moment.Duration; - namespace?: string; - resourceregion?: string; - value: Metric[]; -} - -/** - * @class - * Initializes a new instance of the BaselineMetadataValue class. - * @constructor - * Represents a baseline metadata value. - * - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ -export interface BaselineMetadataValue { - name?: LocalizableString; - value?: string; -} - -/** - * @class - * Initializes a new instance of the Baseline class. - * @constructor - * The baseline values for a single sensitivity value. - * - * @member {string} sensitivity the sensitivity of the baseline. Possible - * values include: 'Low', 'Medium', 'High' - * @member {array} lowThresholds The low thresholds of the baseline. - * @member {array} highThresholds The high thresholds of the baseline. - */ -export interface Baseline { - sensitivity: string; - lowThresholds: number[]; - highThresholds: number[]; -} - -/** - * @class - * Initializes a new instance of the BaselineResponse class. - * @constructor - * The response to a baseline query. - * - * @member {string} [id] the metric baseline Id. - * @member {string} [type] the resource type of the baseline resource. - * @member {object} [name] the name and the display name of the metric, i.e. it - * is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [timespan] The timespan for which the data was retrieved. - * Its value consists of two datatimes concatenated, separated by '/'. This - * may be adjusted in the future and returned back from what was originally - * requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if a - * metadata request was made. - * @member {string} [aggregation] The aggregation type of the metric. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} [baseline] the baseline values for each sensitivity. - * @member {array} [metadata] the baseline metadata values. - */ -export interface BaselineResponse { - readonly id?: string; - readonly type?: string; - readonly name?: LocalizableString; - timespan?: string; - interval?: moment.Duration; - aggregation?: string; - timestamps?: Date[]; - baseline?: Baseline[]; - metadata?: BaselineMetadataValue[]; -} - -/** - * @class - * Initializes a new instance of the TimeSeriesInformation class. - * @constructor - * The time series info needed for calculating the baseline. - * - * @member {array} sensitivities the list of sensitivities for calculating the - * baseline. - * @member {array} values The metric values to calculate the baseline. - * @member {array} [timestamps] the array of timestamps of the baselines. - */ -export interface TimeSeriesInformation { - sensitivities: string[]; - values: number[]; - timestamps?: Date[]; -} - -/** - * @class - * Initializes a new instance of the CalculateBaselineResponse class. - * @constructor - * The response to a calcualte baseline call. - * - * @member {string} type the resource type of the baseline resource. - * @member {array} [timestamps] the array of timestamps of the baselines. - * @member {array} baseline the baseline values for each sensitivity. - */ -export interface CalculateBaselineResponse { - type: string; - timestamps?: Date[]; - baseline: Baseline[]; -} - -/** - * @class - * Initializes a new instance of the Action class. - * @constructor - * An alert action. - * - * @member {string} [actionGroupId] the id of the action group to use. - * @member {object} [webhookProperties] - */ -export interface Action { - actionGroupId?: string; - webhookProperties?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the MetricAlertCriteria class. - * @constructor - * The rule criteria that defines the conditions of the alert rule. - * - * @member {string} odatatype Polymorphic Discriminator - */ -export interface MetricAlertCriteria { - odatatype: string; - /** - * @property Describes unknown properties. The value of an unknown property - * can be of "any" type. - */ - [property: string]: any; -} - -/** - * @class - * Initializes a new instance of the MetricAlertResource class. - * @constructor - * The metric alert resource. - * - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert is - * scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert is - * evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface MetricAlertResource extends Resource { - description: string; - severity: number; - enabled: boolean; - scopes?: string[]; - evaluationFrequency: moment.Duration; - windowSize: moment.Duration; - criteria: MetricAlertCriteria; - actions?: Action[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the MetricAlertResourcePatch class. - * @constructor - * The metric alert resource for patch operations. - * - * @member {object} [tags] Resource tags - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert is - * scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert is - * evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ -export interface MetricAlertResourcePatch { - tags?: { [propertyName: string]: string }; - description: string; - severity: number; - enabled: boolean; - scopes?: string[]; - evaluationFrequency: moment.Duration; - windowSize: moment.Duration; - criteria: MetricAlertCriteria; - actions?: Action[]; - readonly lastUpdatedTime?: Date; -} - -/** - * @class - * Initializes a new instance of the MetricAlertStatusProperties class. - * @constructor - * An alert status properties. - * - * @member {object} [dimensions] - * @member {string} [status] status value - * @member {date} [timestamp] UTC time when the status was checked. - */ -export interface MetricAlertStatusProperties { - dimensions?: { [propertyName: string]: string }; - status?: string; - timestamp?: Date; -} - -/** - * @class - * Initializes a new instance of the MetricAlertStatus class. - * @constructor - * An alert status. - * - * @member {string} [name] The status name. - * @member {string} [id] The alert rule arm id. - * @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 {string} [properties.status] status value - * @member {date} [properties.timestamp] UTC time when the status was checked. - */ -export interface MetricAlertStatus { - name?: string; - id?: string; - type?: string; - properties?: MetricAlertStatusProperties; -} - -/** - * @class - * Initializes a new instance of the MetricAlertStatusCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - * @member {array} [value] the values for the alert rule resources. - */ -export interface MetricAlertStatusCollection { - value?: MetricAlertStatus[]; -} - -/** - * @class - * Initializes a new instance of the MetricDimension class. - * @constructor - * @member {string} name Name of the dimension. - * @member {string} operator the dimension operator. - * @member {array} values list of dimension values. - */ -export interface MetricDimension { - name: string; - operator: string; - values: string[]; -} - -/** - * @class - * Initializes a new instance of the MetricCriteria class. - * @constructor - * @member {string} name Name of the criteria. - * @member {string} metricName Name of the metric. - * @member {string} [metricNamespace] Namespace of the metric. - * @member {object} operator the criteria operator. - * @member {object} timeAggregation the criteria time aggregation types. - * @member {number} threshold the criteria threshold value that activates the - * alert. - * @member {array} [dimensions] List of dimension conditions. - */ -export interface MetricCriteria { - name: string; - metricName: string; - metricNamespace?: string; - operator: any; - timeAggregation: any; - threshold: number; - dimensions?: MetricDimension[]; -} - -/** - * @class - * Initializes a new instance of the MetricAlertSingleResourceMultipleMetricCriteria class. - * @constructor - * Specifies the metric alert criteria for a single resource that has multiple - * metric criteria. - * - * @member {array} [allOf] The list of metric criteria for this 'all of' - * operation. - */ -export interface MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { - allOf?: MetricCriteria[]; -} - - -/** - * @class - * Initializes a new instance of the AutoscaleSettingResourceCollection class. - * @constructor - * Represents a collection of autoscale setting resources. - * - * @member {string} [nextLink] URL to get the next set of results. - */ -export interface AutoscaleSettingResourceCollection extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the IncidentListResult class. - * @constructor - * The List incidents operation response. - * - */ -export interface IncidentListResult extends Array { -} - -/** - * @class - * Initializes a new instance of the AlertRuleResourceCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - */ -export interface AlertRuleResourceCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the LogProfileCollection class. - * @constructor - * Represents a collection of log profiles. - * - */ -export interface LogProfileCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the ActionGroupList class. - * @constructor - * A list of action groups. - * - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ -export interface ActionGroupList extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the ActivityLogAlertList class. - * @constructor - * A list of activity log alerts. - * - * @member {string} [nextLink] Provides the link to retrieve the next set of - * elements. - */ -export interface ActivityLogAlertList extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the EventDataCollection class. - * @constructor - * Represents collection of events. - * - * @member {string} [nextLink] Provides the link to retrieve the next set of - * events. - */ -export interface EventDataCollection extends Array { - nextLink?: string; -} - -/** - * @class - * Initializes a new instance of the EventCategoryCollection class. - * @constructor - * A collection of event categories. Currently possible values are: - * Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. - * - */ -export interface EventCategoryCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the MetricDefinitionCollection class. - * @constructor - * Represents collection of metric definitions. - * - */ -export interface MetricDefinitionCollection extends Array { -} - -/** - * @class - * Initializes a new instance of the MetricAlertResourceCollection class. - * @constructor - * Represents a collection of alert rule resources. - * - */ -export interface MetricAlertResourceCollection extends Array { -} diff --git a/lib/services/monitor/lib/lib/models/index.js b/lib/services/monitor/lib/lib/models/index.js deleted file mode 100644 index 878adabbd3..0000000000 --- a/lib/services/monitor/lib/lib/models/index.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -var msRestAzure = require('ms-rest-azure'); - -exports.BaseResource = msRestAzure.BaseResource; -exports.CloudError = msRestAzure.CloudError; -exports.Resource = require('./resource'); -exports.ScaleCapacity = require('./scaleCapacity'); -exports.MetricTrigger = require('./metricTrigger'); -exports.ScaleAction = require('./scaleAction'); -exports.ScaleRule = require('./scaleRule'); -exports.TimeWindow = require('./timeWindow'); -exports.RecurrentSchedule = require('./recurrentSchedule'); -exports.Recurrence = require('./recurrence'); -exports.AutoscaleProfile = require('./autoscaleProfile'); -exports.EmailNotification = require('./emailNotification'); -exports.WebhookNotification = require('./webhookNotification'); -exports.AutoscaleNotification = require('./autoscaleNotification'); -exports.AutoscaleSettingResource = require('./autoscaleSettingResource'); -exports.AutoscaleSettingResourcePatch = require('./autoscaleSettingResourcePatch'); -exports.ErrorResponse = require('./errorResponse'); -exports.OperationDisplay = require('./operationDisplay'); -exports.Operation = require('./operation'); -exports.OperationListResult = require('./operationListResult'); -exports.Incident = require('./incident'); -exports.RuleDataSource = require('./ruleDataSource'); -exports.RuleCondition = require('./ruleCondition'); -exports.RuleMetricDataSource = require('./ruleMetricDataSource'); -exports.RuleManagementEventClaimsDataSource = require('./ruleManagementEventClaimsDataSource'); -exports.RuleManagementEventDataSource = require('./ruleManagementEventDataSource'); -exports.ThresholdRuleCondition = require('./thresholdRuleCondition'); -exports.LocationThresholdRuleCondition = require('./locationThresholdRuleCondition'); -exports.ManagementEventAggregationCondition = require('./managementEventAggregationCondition'); -exports.ManagementEventRuleCondition = require('./managementEventRuleCondition'); -exports.RuleAction = require('./ruleAction'); -exports.RuleEmailAction = require('./ruleEmailAction'); -exports.RuleWebhookAction = require('./ruleWebhookAction'); -exports.AlertRuleResource = require('./alertRuleResource'); -exports.AlertRuleResourcePatch = require('./alertRuleResourcePatch'); -exports.RetentionPolicy = require('./retentionPolicy'); -exports.LogProfileResource = require('./logProfileResource'); -exports.LogProfileResourcePatch = require('./logProfileResourcePatch'); -exports.ProxyOnlyResource = require('./proxyOnlyResource'); -exports.MetricSettings = require('./metricSettings'); -exports.LogSettings = require('./logSettings'); -exports.DiagnosticSettingsResource = require('./diagnosticSettingsResource'); -exports.DiagnosticSettingsResourceCollection = require('./diagnosticSettingsResourceCollection'); -exports.DiagnosticSettingsCategoryResource = require('./diagnosticSettingsCategoryResource'); -exports.DiagnosticSettingsCategoryResourceCollection = require('./diagnosticSettingsCategoryResourceCollection'); -exports.EmailReceiver = require('./emailReceiver'); -exports.SmsReceiver = require('./smsReceiver'); -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'); -exports.ActivityLogAlertLeafCondition = require('./activityLogAlertLeafCondition'); -exports.ActivityLogAlertAllOfCondition = require('./activityLogAlertAllOfCondition'); -exports.ActivityLogAlertActionGroup = require('./activityLogAlertActionGroup'); -exports.ActivityLogAlertActionList = require('./activityLogAlertActionList'); -exports.ActivityLogAlertResource = require('./activityLogAlertResource'); -exports.ActivityLogAlertPatchBody = require('./activityLogAlertPatchBody'); -exports.LocalizableString = require('./localizableString'); -exports.SenderAuthorization = require('./senderAuthorization'); -exports.HttpRequestInfo = require('./httpRequestInfo'); -exports.EventData = require('./eventData'); -exports.MetricAvailability = require('./metricAvailability'); -exports.MetricDefinition = require('./metricDefinition'); -exports.MetricValue = require('./metricValue'); -exports.MetadataValue = require('./metadataValue'); -exports.TimeSeriesElement = require('./timeSeriesElement'); -exports.Metric = require('./metric'); -exports.Response = require('./response'); -exports.BaselineMetadataValue = require('./baselineMetadataValue'); -exports.Baseline = require('./baseline'); -exports.BaselineResponse = require('./baselineResponse'); -exports.TimeSeriesInformation = require('./timeSeriesInformation'); -exports.CalculateBaselineResponse = require('./calculateBaselineResponse'); -exports.Action = require('./action'); -exports.MetricAlertCriteria = require('./metricAlertCriteria'); -exports.MetricAlertResource = require('./metricAlertResource'); -exports.MetricAlertResourcePatch = require('./metricAlertResourcePatch'); -exports.MetricAlertStatusProperties = require('./metricAlertStatusProperties'); -exports.MetricAlertStatus = require('./metricAlertStatus'); -exports.MetricAlertStatusCollection = require('./metricAlertStatusCollection'); -exports.MetricDimension = require('./metricDimension'); -exports.MetricCriteria = require('./metricCriteria'); -exports.MetricAlertSingleResourceMultipleMetricCriteria = require('./metricAlertSingleResourceMultipleMetricCriteria'); -exports.AutoscaleSettingResourceCollection = require('./autoscaleSettingResourceCollection'); -exports.IncidentListResult = require('./incidentListResult'); -exports.AlertRuleResourceCollection = require('./alertRuleResourceCollection'); -exports.LogProfileCollection = require('./logProfileCollection'); -exports.ActionGroupList = require('./actionGroupList'); -exports.ActivityLogAlertList = require('./activityLogAlertList'); -exports.EventDataCollection = require('./eventDataCollection'); -exports.EventCategoryCollection = require('./eventCategoryCollection'); -exports.MetricDefinitionCollection = require('./metricDefinitionCollection'); -exports.MetricAlertResourceCollection = require('./metricAlertResourceCollection'); -exports.discriminators = { - 'RuleDataSource' : exports.RuleDataSource, - 'RuleCondition' : exports.RuleCondition, - 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource' : exports.RuleMetricDataSource, - 'RuleDataSource.Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' : exports.RuleManagementEventDataSource, - 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition' : exports.ThresholdRuleCondition, - 'RuleCondition.Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' : exports.LocationThresholdRuleCondition, - 'RuleCondition.Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition' : exports.ManagementEventRuleCondition, - 'RuleAction' : exports.RuleAction, - '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 -}; diff --git a/lib/services/monitor/lib/lib/models/itsmReceiver.js b/lib/services/monitor/lib/lib/models/itsmReceiver.js deleted file mode 100644 index a46c94b4d3..0000000000 --- a/lib/services/monitor/lib/lib/models/itsmReceiver.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 Itsm receiver. - * - */ -class ItsmReceiver { - /** - * Create a ItsmReceiver. - * @member {string} name The name of the Itsm receiver. Names must be unique - * across all receivers within an action group. - * @member {string} workspaceId OMS LA instance identifier. - * @member {string} connectionId Unique identification of ITSM connection - * among multiple defined in above workspace. - * @member {string} ticketConfiguration JSON blob for the configurations of - * the ITSM action. CreateMultipleWorkItems option will be part of this blob - * as well. - * @member {string} region Region in which workspace resides. Supported - * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - */ - constructor() { - } - - /** - * Defines the metadata of ItsmReceiver - * - * @returns {object} metadata of ItsmReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'ItsmReceiver', - type: { - name: 'Composite', - className: 'ItsmReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - workspaceId: { - required: true, - serializedName: 'workspaceId', - type: { - name: 'String' - } - }, - connectionId: { - required: true, - serializedName: 'connectionId', - type: { - name: 'String' - } - }, - ticketConfiguration: { - required: true, - serializedName: 'ticketConfiguration', - type: { - name: 'String' - } - }, - region: { - required: true, - serializedName: 'region', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ItsmReceiver; diff --git a/lib/services/monitor/lib/lib/models/localizableString.js b/lib/services/monitor/lib/lib/models/localizableString.js deleted file mode 100644 index 357dc90351..0000000000 --- a/lib/services/monitor/lib/lib/models/localizableString.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 localizable string class. - * - */ -class LocalizableString { - /** - * Create a LocalizableString. - * @member {string} value the invariant value. - * @member {string} [localizedValue] the locale specific value. - */ - constructor() { - } - - /** - * Defines the metadata of LocalizableString - * - * @returns {object} metadata of LocalizableString - * - */ - mapper() { - return { - required: false, - serializedName: 'LocalizableString', - type: { - name: 'Composite', - className: 'LocalizableString', - modelProperties: { - value: { - required: true, - serializedName: 'value', - type: { - name: 'String' - } - }, - localizedValue: { - required: false, - serializedName: 'localizedValue', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = LocalizableString; diff --git a/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js deleted file mode 100644 index c432f200c8..0000000000 --- a/lib/services/monitor/lib/lib/models/locationThresholdRuleCondition.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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'); - -/** - * A rule condition based on a certain number of locations failing. - * - * @extends models['RuleCondition'] - */ -class LocationThresholdRuleCondition extends models['RuleCondition'] { - /** - * Create a LocationThresholdRuleCondition. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {number} failedLocationCount the number of locations that must - * fail to activate the alert. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LocationThresholdRuleCondition - * - * @returns {object} metadata of LocationThresholdRuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'LocationThresholdRuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - windowSize: { - required: false, - serializedName: 'windowSize', - type: { - name: 'TimeSpan' - } - }, - failedLocationCount: { - required: true, - serializedName: 'failedLocationCount', - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = LocationThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/logProfileCollection.js b/lib/services/monitor/lib/lib/models/logProfileCollection.js deleted file mode 100644 index d2530db617..0000000000 --- a/lib/services/monitor/lib/lib/models/logProfileCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 profiles. - */ -class LogProfileCollection extends Array { - /** - * Create a LogProfileCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LogProfileCollection - * - * @returns {object} metadata of LogProfileCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'LogProfileCollection', - type: { - name: 'Composite', - className: 'LogProfileCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LogProfileResourceElementType', - type: { - name: 'Composite', - className: 'LogProfileResource' - } - } - } - } - } - } - }; - } -} - -module.exports = LogProfileCollection; diff --git a/lib/services/monitor/lib/lib/models/logProfileResource.js b/lib/services/monitor/lib/lib/models/logProfileResource.js deleted file mode 100644 index 69a8f54034..0000000000 --- a/lib/services/monitor/lib/lib/models/logProfileResource.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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 profile resource. - * - * @extends models['Resource'] - */ -class LogProfileResource extends models['Resource'] { - /** - * Create a LogProfileResource. - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories - * are created as is convenient to the user. Some values are: 'Write', - * 'Delete', and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in - * the log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LogProfileResource - * - * @returns {object} metadata of LogProfileResource - * - */ - mapper() { - return { - required: false, - serializedName: 'LogProfileResource', - type: { - name: 'Composite', - className: 'LogProfileResource', - 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' - } - } - } - }, - storageAccountId: { - required: false, - serializedName: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - serviceBusRuleId: { - required: false, - serializedName: 'properties.serviceBusRuleId', - type: { - name: 'String' - } - }, - locations: { - required: true, - serializedName: 'properties.locations', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - categories: { - required: true, - serializedName: 'properties.categories', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - retentionPolicy: { - required: true, - serializedName: 'properties.retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = LogProfileResource; diff --git a/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js b/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js deleted file mode 100644 index f9b2822b45..0000000000 --- a/lib/services/monitor/lib/lib/models/logProfileResourcePatch.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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 profile resource for patch operations. - * - */ -class LogProfileResourcePatch { - /** - * Create a LogProfileResourcePatch. - * @member {object} [tags] Resource tags - * @member {string} [storageAccountId] the resource id of the storage account - * to which you would like to send the Activity Log. - * @member {string} [serviceBusRuleId] The service bus rule ID of the service - * bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * @member {array} locations List of regions for which Activity Log events - * should be stored or streamed. It is a comma separated list of valid ARM - * locations including the 'global' location. - * @member {array} categories the categories of the logs. These categories - * are created as is convenient to the user. Some values are: 'Write', - * 'Delete', and/or 'Action.' - * @member {object} retentionPolicy the retention policy for the events in - * the log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of LogProfileResourcePatch - * - * @returns {object} metadata of LogProfileResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'LogProfileResourcePatch', - type: { - name: 'Composite', - className: 'LogProfileResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - storageAccountId: { - required: false, - serializedName: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - serviceBusRuleId: { - required: false, - serializedName: 'properties.serviceBusRuleId', - type: { - name: 'String' - } - }, - locations: { - required: true, - serializedName: 'properties.locations', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - categories: { - required: true, - serializedName: 'properties.categories', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - retentionPolicy: { - required: true, - serializedName: 'properties.retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = LogProfileResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/logSettings.js b/lib/services/monitor/lib/lib/models/logSettings.js deleted file mode 100644 index de7aa7b6c6..0000000000 --- a/lib/services/monitor/lib/lib/models/logSettings.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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'); - -/** - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular log. - * - */ -class LogSettings { - /** - * Create a LogSettings. - * @member {string} [category] Name of a Diagnostic Log category for a - * resource type this setting is applied to. To obtain the list of Diagnostic - * Log categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this log is enabled. - * @member {object} [retentionPolicy] the retention policy for this log. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of LogSettings - * - * @returns {object} metadata of LogSettings - * - */ - mapper() { - return { - required: false, - serializedName: 'LogSettings', - type: { - name: 'Composite', - className: 'LogSettings', - modelProperties: { - category: { - required: false, - serializedName: 'category', - type: { - name: 'String' - } - }, - enabled: { - required: true, - serializedName: 'enabled', - type: { - name: 'Boolean' - } - }, - retentionPolicy: { - required: false, - serializedName: 'retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = LogSettings; diff --git a/lib/services/monitor/lib/lib/models/logicAppReceiver.js b/lib/services/monitor/lib/lib/models/logicAppReceiver.js deleted file mode 100644 index 9e7a9f1a52..0000000000 --- a/lib/services/monitor/lib/lib/models/logicAppReceiver.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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/monitor/lib/lib/models/managementEventAggregationCondition.js b/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js deleted file mode 100644 index 29aa3f55f9..0000000000 --- a/lib/services/monitor/lib/lib/models/managementEventAggregationCondition.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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'; - -/** - * How the data that is collected should be combined over time. - * - */ -class ManagementEventAggregationCondition { - /** - * Create a ManagementEventAggregationCondition. - * @member {string} [operator] the condition operator. Possible values - * include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [threshold] The threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - */ - constructor() { - } - - /** - * Defines the metadata of ManagementEventAggregationCondition - * - * @returns {object} metadata of ManagementEventAggregationCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'ManagementEventAggregationCondition', - type: { - name: 'Composite', - className: 'ManagementEventAggregationCondition', - modelProperties: { - operator: { - required: false, - serializedName: 'operator', - type: { - name: 'Enum', - allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] - } - }, - threshold: { - required: false, - serializedName: 'threshold', - type: { - name: 'Number' - } - }, - windowSize: { - required: false, - serializedName: 'windowSize', - type: { - name: 'TimeSpan' - } - } - } - } - }; - } -} - -module.exports = ManagementEventAggregationCondition; diff --git a/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js b/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js deleted file mode 100644 index d06bfc5742..0000000000 --- a/lib/services/monitor/lib/lib/models/managementEventRuleCondition.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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'); - -/** - * A management event rule condition. - * - * @extends models['RuleCondition'] - */ -class ManagementEventRuleCondition extends models['RuleCondition'] { - /** - * Create a ManagementEventRuleCondition. - * @member {object} [aggregation] How the data that is collected should be - * combined over time and when the alert is activated. Note that for - * management event alerts aggregation is optional – if it is not provided - * then any event will cause the alert to activate. - * @member {string} [aggregation.operator] the condition operator. Possible - * values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [aggregation.threshold] The threshold value that - * activates the alert. - * @member {moment.duration} [aggregation.windowSize] the period of time (in - * ISO 8601 duration format) that is used to monitor alert activity based on - * the threshold. If specified then it must be between 5 minutes and 1 day. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ManagementEventRuleCondition - * - * @returns {object} metadata of ManagementEventRuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'ManagementEventRuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - aggregation: { - required: false, - serializedName: 'aggregation', - type: { - name: 'Composite', - className: 'ManagementEventAggregationCondition' - } - } - } - } - }; - } -} - -module.exports = ManagementEventRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/metadataValue.js b/lib/services/monitor/lib/lib/models/metadataValue.js deleted file mode 100644 index e57162fef2..0000000000 --- a/lib/services/monitor/lib/lib/models/metadataValue.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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'); - -/** - * Represents a metric metadata value. - * - */ -class MetadataValue { - /** - * Create a MetadataValue. - * @member {object} [name] the name of the metadata. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [value] the value of the metadata. - */ - constructor() { - } - - /** - * Defines the metadata of MetadataValue - * - * @returns {object} metadata of MetadataValue - * - */ - mapper() { - return { - required: false, - serializedName: 'MetadataValue', - type: { - name: 'Composite', - className: 'MetadataValue', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - value: { - required: false, - serializedName: 'value', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = MetadataValue; diff --git a/lib/services/monitor/lib/lib/models/metric.js b/lib/services/monitor/lib/lib/models/metric.js deleted file mode 100644 index 62f4e00afc..0000000000 --- a/lib/services/monitor/lib/lib/models/metric.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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 result data of a query. - * - */ -class Metric { - /** - * Create a Metric. - * @member {string} id the metric Id. - * @member {string} type the resource type of the metric resource. - * @member {object} name the name and the display name of the metric, i.e. it - * is localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} unit the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {array} timeseries the time series returned when a data query is - * performed. - */ - constructor() { - } - - /** - * Defines the metadata of Metric - * - * @returns {object} metadata of Metric - * - */ - mapper() { - return { - required: false, - serializedName: 'Metric', - type: { - name: 'Composite', - className: 'Metric', - modelProperties: { - id: { - required: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - type: { - required: true, - serializedName: 'type', - type: { - name: 'String' - } - }, - name: { - required: true, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - unit: { - required: true, - serializedName: 'unit', - type: { - name: 'Enum', - allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] - } - }, - timeseries: { - required: true, - serializedName: 'timeseries', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'TimeSeriesElementElementType', - type: { - name: 'Composite', - className: 'TimeSeriesElement' - } - } - } - } - } - } - }; - } -} - -module.exports = Metric; diff --git a/lib/services/monitor/lib/lib/models/metricAlertCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertCriteria.js deleted file mode 100644 index 1a423dbb2d..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertCriteria.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 rule criteria that defines the conditions of the alert rule. - * - */ -class MetricAlertCriteria { - /** - * Create a MetricAlertCriteria. - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertCriteria - * - * @returns {object} metadata of MetricAlertCriteria - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertCriteria', - type: { - name: 'Composite', - additionalProperties: { - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'ObjectElementType', - type: { - name: 'Object' - } - } - } - }, - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertCriteria', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = MetricAlertCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResource.js b/lib/services/monitor/lib/lib/models/metricAlertResource.js deleted file mode 100644 index c21174220c..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertResource.js +++ /dev/null @@ -1,208 +0,0 @@ -/* - * 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 metric alert resource. - * - * @extends models['Resource'] - */ -class MetricAlertResource extends models['Resource'] { - /** - * Create a MetricAlertResource. - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert - * is scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert - * is evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricAlertResource - * - * @returns {object} metadata of MetricAlertResource - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertResource', - type: { - name: 'Composite', - className: 'MetricAlertResource', - 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: true, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - severity: { - required: true, - serializedName: 'properties.severity', - type: { - name: 'Number' - } - }, - enabled: { - required: true, - serializedName: 'properties.enabled', - type: { - name: 'Boolean' - } - }, - scopes: { - required: false, - serializedName: 'properties.scopes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - evaluationFrequency: { - required: true, - serializedName: 'properties.evaluationFrequency', - type: { - name: 'TimeSpan' - } - }, - windowSize: { - required: true, - serializedName: 'properties.windowSize', - type: { - name: 'TimeSpan' - } - }, - criteria: { - required: true, - serializedName: 'properties.criteria', - type: { - name: 'Composite', - additionalProperties: { - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'ObjectElementType', - type: { - name: 'Object' - } - } - } - }, - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertCriteria' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionElementType', - type: { - name: 'Composite', - className: 'Action' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = MetricAlertResource; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js b/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js deleted file mode 100644 index 4e54250e8c..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertResourceCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 alert rule resources. - */ -class MetricAlertResourceCollection extends Array { - /** - * Create a MetricAlertResourceCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricAlertResourceCollection - * - * @returns {object} metadata of MetricAlertResourceCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertResourceCollection', - type: { - name: 'Composite', - className: 'MetricAlertResourceCollection', - modelProperties: { - value: { - required: false, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricAlertResourceElementType', - type: { - name: 'Composite', - className: 'MetricAlertResource' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricAlertResourceCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js b/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js deleted file mode 100644 index 1832373f2d..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertResourcePatch.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 metric alert resource for patch operations. - * - */ -class MetricAlertResourcePatch { - /** - * Create a MetricAlertResourcePatch. - * @member {object} [tags] Resource tags - * @member {string} description the description of the metric alert that will - * be included in the alert email. - * @member {number} severity Alert severity {0, 1, 2, 3, 4} - * @member {boolean} enabled the flag that indicates whether the metric alert - * is enabled. - * @member {array} [scopes] the list of resource id's that this metric alert - * is scoped to. - * @member {moment.duration} evaluationFrequency how often the metric alert - * is evaluated represented in ISO 8601 duration format. - * @member {moment.duration} windowSize the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. - * @member {object} criteria defines the specific alert criteria information. - * @member {string} [criteria.odatatype] Polymorphic Discriminator - * @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 - * format. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertResourcePatch - * - * @returns {object} metadata of MetricAlertResourcePatch - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertResourcePatch', - type: { - name: 'Composite', - className: 'MetricAlertResourcePatch', - modelProperties: { - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - description: { - required: true, - serializedName: 'properties.description', - type: { - name: 'String' - } - }, - severity: { - required: true, - serializedName: 'properties.severity', - type: { - name: 'Number' - } - }, - enabled: { - required: true, - serializedName: 'properties.enabled', - type: { - name: 'Boolean' - } - }, - scopes: { - required: false, - serializedName: 'properties.scopes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - evaluationFrequency: { - required: true, - serializedName: 'properties.evaluationFrequency', - type: { - name: 'TimeSpan' - } - }, - windowSize: { - required: true, - serializedName: 'properties.windowSize', - type: { - name: 'TimeSpan' - } - }, - criteria: { - required: true, - serializedName: 'properties.criteria', - type: { - name: 'Composite', - additionalProperties: { - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'ObjectElementType', - type: { - name: 'Object' - } - } - } - }, - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertCriteria' - } - }, - actions: { - required: false, - serializedName: 'properties.actions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionElementType', - type: { - name: 'Composite', - className: 'Action' - } - } - } - }, - lastUpdatedTime: { - required: false, - readOnly: true, - serializedName: 'properties.lastUpdatedTime', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = MetricAlertResourcePatch; diff --git a/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js b/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js deleted file mode 100644 index 99a72bf055..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertSingleResourceMultipleMetricCriteria.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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'); - -/** - * Specifies the metric alert criteria for a single resource that has multiple - * metric criteria. - * - * @extends models['MetricAlertCriteria'] - */ -class MetricAlertSingleResourceMultipleMetricCriteria extends models['MetricAlertCriteria'] { - /** - * Create a MetricAlertSingleResourceMultipleMetricCriteria. - * @member {array} [allOf] The list of metric criteria for this 'all of' - * operation. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricAlertSingleResourceMultipleMetricCriteria - * - * @returns {object} metadata of MetricAlertSingleResourceMultipleMetricCriteria - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'MetricAlertCriteria', - className: 'MetricAlertSingleResourceMultipleMetricCriteria', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - allOf: { - required: false, - serializedName: 'allOf', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricCriteriaElementType', - type: { - name: 'Composite', - className: 'MetricCriteria' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricAlertSingleResourceMultipleMetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatus.js b/lib/services/monitor/lib/lib/models/metricAlertStatus.js deleted file mode 100644 index 6df29691be..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertStatus.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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'); - -/** - * An alert status. - * - */ -class MetricAlertStatus { - /** - * Create a MetricAlertStatus. - * @member {string} [name] The status name. - * @member {string} [id] The alert rule arm id. - * @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 {string} [properties.status] status value - * @member {date} [properties.timestamp] UTC time when the status was - * checked. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertStatus - * - * @returns {object} metadata of MetricAlertStatus - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertStatus', - type: { - name: 'Composite', - className: 'MetricAlertStatus', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'String' - } - }, - id: { - required: false, - serializedName: 'id', - type: { - name: 'String' - } - }, - type: { - required: false, - serializedName: 'type', - type: { - name: 'String' - } - }, - properties: { - required: false, - serializedName: 'properties', - type: { - name: 'Composite', - className: 'MetricAlertStatusProperties' - } - } - } - } - }; - } -} - -module.exports = MetricAlertStatus; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js b/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js deleted file mode 100644 index e3679d730b..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertStatusCollection.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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'); - -/** - * Represents a collection of alert rule resources. - * - */ -class MetricAlertStatusCollection { - /** - * Create a MetricAlertStatusCollection. - * @member {array} [value] the values for the alert rule resources. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertStatusCollection - * - * @returns {object} metadata of MetricAlertStatusCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertStatusCollection', - type: { - name: 'Composite', - className: 'MetricAlertStatusCollection', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricAlertStatusElementType', - type: { - name: 'Composite', - className: 'MetricAlertStatus' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricAlertStatusCollection; diff --git a/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js b/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js deleted file mode 100644 index b9581c6cda..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAlertStatusProperties.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 status properties. - * - */ -class MetricAlertStatusProperties { - /** - * Create a MetricAlertStatusProperties. - * @member {object} [dimensions] - * @member {string} [status] status value - * @member {date} [timestamp] UTC time when the status was checked. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAlertStatusProperties - * - * @returns {object} metadata of MetricAlertStatusProperties - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAlertStatusProperties', - type: { - name: 'Composite', - className: 'MetricAlertStatusProperties', - modelProperties: { - dimensions: { - required: false, - serializedName: 'dimensions', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - status: { - required: false, - serializedName: 'status', - type: { - name: 'String' - } - }, - timestamp: { - required: false, - serializedName: 'timestamp', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = MetricAlertStatusProperties; diff --git a/lib/services/monitor/lib/lib/models/metricAvailability.js b/lib/services/monitor/lib/lib/models/metricAvailability.js deleted file mode 100644 index b8374a22c0..0000000000 --- a/lib/services/monitor/lib/lib/models/metricAvailability.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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'; - -/** - * Metric availability specifies the time grain (aggregation interval or - * frequency) and the retention period for that time grain. - * - */ -class MetricAvailability { - /** - * Create a MetricAvailability. - * @member {moment.duration} [timeGrain] the time grain specifies the - * aggregation interval for the metric. Expressed as a duration 'PT1M', - * 'P1D', etc. - * @member {moment.duration} [retention] the retention period for the metric - * at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - */ - constructor() { - } - - /** - * Defines the metadata of MetricAvailability - * - * @returns {object} metadata of MetricAvailability - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricAvailability', - type: { - name: 'Composite', - className: 'MetricAvailability', - modelProperties: { - timeGrain: { - required: false, - serializedName: 'timeGrain', - type: { - name: 'TimeSpan' - } - }, - retention: { - required: false, - serializedName: 'retention', - type: { - name: 'TimeSpan' - } - } - } - } - }; - } -} - -module.exports = MetricAvailability; diff --git a/lib/services/monitor/lib/lib/models/metricCriteria.js b/lib/services/monitor/lib/lib/models/metricCriteria.js deleted file mode 100644 index 19192dc18a..0000000000 --- a/lib/services/monitor/lib/lib/models/metricCriteria.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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'); - -/** - * Class representing a MetricCriteria. - */ -class MetricCriteria { - /** - * Create a MetricCriteria. - * @member {string} name Name of the criteria. - * @member {string} metricName Name of the metric. - * @member {string} [metricNamespace] Namespace of the metric. - * @member {object} operator the criteria operator. - * @member {object} timeAggregation the criteria time aggregation types. - * @member {number} threshold the criteria threshold value that activates the - * alert. - * @member {array} [dimensions] List of dimension conditions. - */ - constructor() { - } - - /** - * Defines the metadata of MetricCriteria - * - * @returns {object} metadata of MetricCriteria - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricCriteria', - type: { - name: 'Composite', - className: 'MetricCriteria', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - metricName: { - required: true, - serializedName: 'metricName', - type: { - name: 'String' - } - }, - metricNamespace: { - required: false, - serializedName: 'metricNamespace', - type: { - name: 'String' - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'Object' - } - }, - timeAggregation: { - required: true, - serializedName: 'timeAggregation', - type: { - name: 'Object' - } - }, - threshold: { - required: true, - serializedName: 'threshold', - type: { - name: 'Number' - } - }, - dimensions: { - required: false, - serializedName: 'dimensions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricDimensionElementType', - type: { - name: 'Composite', - className: 'MetricDimension' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricCriteria; diff --git a/lib/services/monitor/lib/lib/models/metricDefinition.js b/lib/services/monitor/lib/lib/models/metricDefinition.js deleted file mode 100644 index 06e73cee86..0000000000 --- a/lib/services/monitor/lib/lib/models/metricDefinition.js +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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'); - -/** - * Metric definition class specifies the metadata for a metric. - * - */ -class MetricDefinition { - /** - * Create a MetricDefinition. - * @member {boolean} [isDimensionRequired] Flag to indicate whether the - * dimension is required. - * @member {string} [resourceId] the resource identifier of the resource that - * emitted the metric. - * @member {string} [namespace] the namespace the metric blongs to. - * @member {object} [name] the name and the display name of the metric, i.e. - * it is a localizable string. - * @member {string} [name.value] the invariant value. - * @member {string} [name.localizedValue] the locale specific value. - * @member {string} [unit] the unit of the metric. Possible values include: - * 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - * 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' - * @member {string} [primaryAggregationType] the primary aggregation type - * value defining how to use the values for display. Possible values include: - * 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' - * @member {array} [supportedAggregationTypes] the collection of what - * aggregation types are supported. - * @member {array} [metricAvailabilities] the collection of what aggregation - * intervals are available to be queried. - * @member {string} [id] the resource identifier of the metric definition. - * @member {array} [dimensions] the name and the display name of the - * dimension, i.e. it is a localizable string. - */ - constructor() { - } - - /** - * Defines the metadata of MetricDefinition - * - * @returns {object} metadata of MetricDefinition - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricDefinition', - type: { - name: 'Composite', - className: 'MetricDefinition', - modelProperties: { - isDimensionRequired: { - required: false, - serializedName: 'isDimensionRequired', - type: { - name: 'Boolean' - } - }, - resourceId: { - required: false, - serializedName: 'resourceId', - type: { - name: 'String' - } - }, - namespace: { - required: false, - serializedName: 'namespace', - type: { - name: 'String' - } - }, - name: { - required: false, - serializedName: 'name', - type: { - name: 'Composite', - className: 'LocalizableString' - } - }, - unit: { - required: false, - serializedName: 'unit', - type: { - name: 'Enum', - allowedValues: [ 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified' ] - } - }, - primaryAggregationType: { - required: false, - serializedName: 'primaryAggregationType', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] - } - }, - supportedAggregationTypes: { - required: false, - serializedName: 'supportedAggregationTypes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'AggregationTypeElementType', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total' ] - } - } - } - }, - metricAvailabilities: { - required: false, - serializedName: 'metricAvailabilities', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricAvailabilityElementType', - type: { - name: 'Composite', - className: 'MetricAvailability' - } - } - } - }, - id: { - required: false, - serializedName: 'id', - type: { - name: 'String' - } - }, - dimensions: { - required: false, - serializedName: 'dimensions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'LocalizableStringElementType', - type: { - name: 'Composite', - className: 'LocalizableString' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricDefinition; diff --git a/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js b/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js deleted file mode 100644 index e6466e922a..0000000000 --- a/lib/services/monitor/lib/lib/models/metricDefinitionCollection.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 collection of metric definitions. - */ -class MetricDefinitionCollection extends Array { - /** - * Create a MetricDefinitionCollection. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MetricDefinitionCollection - * - * @returns {object} metadata of MetricDefinitionCollection - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricDefinitionCollection', - type: { - name: 'Composite', - className: 'MetricDefinitionCollection', - modelProperties: { - value: { - required: true, - serializedName: '', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricDefinitionElementType', - type: { - name: 'Composite', - className: 'MetricDefinition' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricDefinitionCollection; diff --git a/lib/services/monitor/lib/lib/models/metricDimension.js b/lib/services/monitor/lib/lib/models/metricDimension.js deleted file mode 100644 index 4805da9870..0000000000 --- a/lib/services/monitor/lib/lib/models/metricDimension.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Class representing a MetricDimension. - */ -class MetricDimension { - /** - * Create a MetricDimension. - * @member {string} name Name of the dimension. - * @member {string} operator the dimension operator. - * @member {array} values list of dimension values. - */ - constructor() { - } - - /** - * Defines the metadata of MetricDimension - * - * @returns {object} metadata of MetricDimension - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricDimension', - type: { - name: 'Composite', - className: 'MetricDimension', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'String' - } - }, - values: { - required: true, - serializedName: 'values', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = MetricDimension; diff --git a/lib/services/monitor/lib/lib/models/metricSettings.js b/lib/services/monitor/lib/lib/models/metricSettings.js deleted file mode 100644 index bdde9809ff..0000000000 --- a/lib/services/monitor/lib/lib/models/metricSettings.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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'); - -/** - * Part of MultiTenantDiagnosticSettings. Specifies the settings for a - * particular metric. - * - */ -class MetricSettings { - /** - * Create a MetricSettings. - * @member {moment.duration} [timeGrain] the timegrain of the metric in - * ISO8601 format. - * @member {string} [category] Name of a Diagnostic Metric category for a - * resource type this setting is applied to. To obtain the list of Diagnostic - * metric categories for a resource, first perform a GET diagnostic settings - * operation. - * @member {boolean} enabled a value indicating whether this category is - * enabled. - * @member {object} [retentionPolicy] the retention policy for this category. - * @member {boolean} [retentionPolicy.enabled] a value indicating whether the - * retention policy is enabled. - * @member {number} [retentionPolicy.days] the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of MetricSettings - * - * @returns {object} metadata of MetricSettings - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricSettings', - type: { - name: 'Composite', - className: 'MetricSettings', - modelProperties: { - timeGrain: { - required: false, - serializedName: 'timeGrain', - type: { - name: 'TimeSpan' - } - }, - category: { - required: false, - serializedName: 'category', - type: { - name: 'String' - } - }, - enabled: { - required: true, - serializedName: 'enabled', - type: { - name: 'Boolean' - } - }, - retentionPolicy: { - required: false, - serializedName: 'retentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy' - } - } - } - } - }; - } -} - -module.exports = MetricSettings; diff --git a/lib/services/monitor/lib/lib/models/metricTrigger.js b/lib/services/monitor/lib/lib/models/metricTrigger.js deleted file mode 100644 index 09e76603e5..0000000000 --- a/lib/services/monitor/lib/lib/models/metricTrigger.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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 trigger that results in a scaling action. - * - */ -class MetricTrigger { - /** - * Create a MetricTrigger. - * @member {string} metricName the name of the metric that defines what the - * rule monitors. - * @member {string} metricResourceUri the resource identifier of the resource - * the rule monitors. - * @member {moment.duration} timeGrain the granularity of metrics the rule - * monitors. Must be one of the predefined values returned from metric - * definitions for the metric. Must be between 12 hours and 1 minute. - * @member {string} statistic the metric statistic type. How the metrics from - * multiple instances are combined. Possible values include: 'Average', - * 'Min', 'Max', 'Sum' - * @member {moment.duration} timeWindow the range of time in which instance - * data is collected. This value must be greater than the delay in metric - * collection, which can vary from resource-to-resource. Must be between 12 - * hours and 5 minutes. - * @member {string} timeAggregation time aggregation type. How the data that - * is collected should be combined over time. The default value is Average. - * Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count' - * @member {string} operator the operator that is used to compare the metric - * data and the threshold. Possible values include: 'Equals', 'NotEquals', - * 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold of the metric that triggers the - * scale action. - */ - constructor() { - } - - /** - * Defines the metadata of MetricTrigger - * - * @returns {object} metadata of MetricTrigger - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricTrigger', - type: { - name: 'Composite', - className: 'MetricTrigger', - modelProperties: { - metricName: { - required: true, - serializedName: 'metricName', - type: { - name: 'String' - } - }, - metricResourceUri: { - required: true, - serializedName: 'metricResourceUri', - type: { - name: 'String' - } - }, - timeGrain: { - required: true, - serializedName: 'timeGrain', - type: { - name: 'TimeSpan' - } - }, - statistic: { - required: true, - serializedName: 'statistic', - type: { - name: 'Enum', - allowedValues: [ 'Average', 'Min', 'Max', 'Sum' ] - } - }, - timeWindow: { - required: true, - serializedName: 'timeWindow', - type: { - name: 'TimeSpan' - } - }, - timeAggregation: { - required: true, - serializedName: 'timeAggregation', - type: { - name: 'Enum', - allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Count' ] - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'Enum', - allowedValues: [ 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] - } - }, - threshold: { - required: true, - serializedName: 'threshold', - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = MetricTrigger; diff --git a/lib/services/monitor/lib/lib/models/metricValue.js b/lib/services/monitor/lib/lib/models/metricValue.js deleted file mode 100644 index 289f6ad9b0..0000000000 --- a/lib/services/monitor/lib/lib/models/metricValue.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 metric value. - * - */ -class MetricValue { - /** - * Create a MetricValue. - * @member {date} timeStamp the timestamp for the metric value in ISO 8601 - * format. - * @member {number} [average] the average value in the time range. - * @member {number} [minimum] the least value in the time range. - * @member {number} [maximum] the greatest value in the time range. - * @member {number} [total] the sum of all of the values in the time range. - * @member {number} [count] the number of samples in the time range. Can be - * used to determine the number of values that contributed to the average - * value. - */ - constructor() { - } - - /** - * Defines the metadata of MetricValue - * - * @returns {object} metadata of MetricValue - * - */ - mapper() { - return { - required: false, - serializedName: 'MetricValue', - type: { - name: 'Composite', - className: 'MetricValue', - modelProperties: { - timeStamp: { - required: true, - serializedName: 'timeStamp', - type: { - name: 'DateTime' - } - }, - average: { - required: false, - serializedName: 'average', - type: { - name: 'Number' - } - }, - minimum: { - required: false, - serializedName: 'minimum', - type: { - name: 'Number' - } - }, - maximum: { - required: false, - serializedName: 'maximum', - type: { - name: 'Number' - } - }, - total: { - required: false, - serializedName: 'total', - type: { - name: 'Number' - } - }, - count: { - required: false, - serializedName: 'count', - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = MetricValue; diff --git a/lib/services/monitor/lib/lib/models/operation.js b/lib/services/monitor/lib/lib/models/operation.js deleted file mode 100644 index 83a27ddcc0..0000000000 --- a/lib/services/monitor/lib/lib/models/operation.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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'); - -/** - * Microsoft Insights API operation definition. - * - */ -class Operation { - /** - * Create a Operation. - * @member {string} [name] Operation name: {provider}/{resource}/{operation} - * @member {object} [display] Display metadata associated with the operation. - * @member {string} [display.provider] Service provider: Microsoft.Insights - * @member {string} [display.resource] Resource on which the operation is - * performed: AlertRules, Autoscale, etc. - * @member {string} [display.operation] Operation type: Read, write, delete, - * etc. - */ - constructor() { - } - - /** - * Defines the metadata of Operation - * - * @returns {object} metadata of Operation - * - */ - mapper() { - return { - required: false, - serializedName: 'Operation', - type: { - name: 'Composite', - className: 'Operation', - modelProperties: { - name: { - required: false, - serializedName: 'name', - type: { - name: 'String' - } - }, - display: { - required: false, - serializedName: 'display', - type: { - name: 'Composite', - className: 'OperationDisplay' - } - } - } - } - }; - } -} - -module.exports = Operation; diff --git a/lib/services/monitor/lib/lib/models/operationDisplay.js b/lib/services/monitor/lib/lib/models/operationDisplay.js deleted file mode 100644 index 8e414a0a13..0000000000 --- a/lib/services/monitor/lib/lib/models/operationDisplay.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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'; - -/** - * Display metadata associated with the operation. - * - */ -class OperationDisplay { - /** - * Create a OperationDisplay. - * @member {string} [provider] Service provider: Microsoft.Insights - * @member {string} [resource] Resource on which the operation is performed: - * AlertRules, Autoscale, etc. - * @member {string} [operation] Operation type: Read, write, delete, etc. - */ - constructor() { - } - - /** - * Defines the metadata of OperationDisplay - * - * @returns {object} metadata of OperationDisplay - * - */ - mapper() { - return { - required: false, - serializedName: 'Operation_display', - type: { - name: 'Composite', - className: 'OperationDisplay', - modelProperties: { - provider: { - required: false, - serializedName: 'provider', - type: { - name: 'String' - } - }, - resource: { - required: false, - serializedName: 'resource', - type: { - name: 'String' - } - }, - operation: { - required: false, - serializedName: 'operation', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = OperationDisplay; diff --git a/lib/services/monitor/lib/lib/models/operationListResult.js b/lib/services/monitor/lib/lib/models/operationListResult.js deleted file mode 100644 index cad3161962..0000000000 --- a/lib/services/monitor/lib/lib/models/operationListResult.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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'); - -/** - * Result of the request to list Microsoft.Insights operations. It contains a - * list of operations and a URL link to get the next set of results. - * - */ -class OperationListResult { - /** - * Create a OperationListResult. - * @member {array} [value] List of operations supported by the - * Microsoft.Insights provider. - * @member {string} [nextLink] URL to get the next set of operation list - * results if there are any. - */ - constructor() { - } - - /** - * Defines the metadata of OperationListResult - * - * @returns {object} metadata of OperationListResult - * - */ - mapper() { - return { - required: false, - serializedName: 'OperationListResult', - type: { - name: 'Composite', - className: 'OperationListResult', - modelProperties: { - value: { - required: false, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'OperationElementType', - type: { - name: 'Composite', - className: 'Operation' - } - } - } - }, - nextLink: { - required: false, - serializedName: 'nextLink', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = OperationListResult; diff --git a/lib/services/monitor/lib/lib/models/proxyOnlyResource.js b/lib/services/monitor/lib/lib/models/proxyOnlyResource.js deleted file mode 100644 index 768abba9af..0000000000 --- a/lib/services/monitor/lib/lib/models/proxyOnlyResource.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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'); - -/** - * A proxy only azure resource object - * - * @extends models['BaseResource'] - */ -class ProxyOnlyResource extends models['BaseResource'] { - /** - * Create a ProxyOnlyResource. - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ProxyOnlyResource - * - * @returns {object} metadata of ProxyOnlyResource - * - */ - mapper() { - return { - required: false, - serializedName: 'ProxyOnlyResource', - type: { - name: 'Composite', - className: 'ProxyOnlyResource', - 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' - } - } - } - } - }; - } -} - -module.exports = ProxyOnlyResource; diff --git a/lib/services/monitor/lib/lib/models/recurrence.js b/lib/services/monitor/lib/lib/models/recurrence.js deleted file mode 100644 index cb2dddd1d5..0000000000 --- a/lib/services/monitor/lib/lib/models/recurrence.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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 repeating times at which this profile begins. This element is not used - * if the FixedDate element is used. - * - */ -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 - * profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard - * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada - * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US - * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - * Atlantic Standard Time, Central Brazilian Standard Time, SA Western - * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. - * South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} [schedule.days] the collection of days that the profile - * takes effect on. Possible values are Sunday through Saturday. - * @member {array} [schedule.hours] A collection of hours that the profile - * takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - * times are not supported). - * @member {array} [schedule.minutes] A collection of minutes at which the - * profile takes effect at. - */ - constructor() { - } - - /** - * Defines the metadata of Recurrence - * - * @returns {object} metadata of Recurrence - * - */ - mapper() { - return { - required: false, - serializedName: 'Recurrence', - type: { - name: 'Composite', - className: 'Recurrence', - modelProperties: { - frequency: { - required: true, - serializedName: 'frequency', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year' ] - } - }, - schedule: { - required: true, - serializedName: 'schedule', - type: { - name: 'Composite', - className: 'RecurrentSchedule' - } - } - } - } - }; - } -} - -module.exports = Recurrence; diff --git a/lib/services/monitor/lib/lib/models/recurrentSchedule.js b/lib/services/monitor/lib/lib/models/recurrentSchedule.js deleted file mode 100644 index dec886f658..0000000000 --- a/lib/services/monitor/lib/lib/models/recurrentSchedule.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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 scheduling constraints for when the profile begins. - * - */ -class RecurrentSchedule { - /** - * Create a RecurrentSchedule. - * @member {string} timeZone the timezone for the hours of the profile. Some - * examples of valid timezones are: Dateline Standard Time, UTC-11, Hawaiian - * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), - * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time - * (Mexico), Mountain Standard Time, Central America Standard Time, Central - * Standard Time, Central Standard Time (Mexico), Canada Central Standard - * Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard - * Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard - * Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific - * SA Standard Time, Newfoundland Standard Time, E. South America Standard - * Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, - * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard - * Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard - * Time, W. Europe Standard Time, Central Europe Standard Time, Romance - * Standard Time, Central European Standard Time, W. Central Africa Standard - * Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, - * Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. - * Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {array} days the collection of days that the profile takes effect - * on. Possible values are Sunday through Saturday. - * @member {array} hours A collection of hours that the profile takes effect - * on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not - * supported). - * @member {array} minutes A collection of minutes at which the profile takes - * effect at. - */ - constructor() { - } - - /** - * Defines the metadata of RecurrentSchedule - * - * @returns {object} metadata of RecurrentSchedule - * - */ - mapper() { - return { - required: false, - serializedName: 'RecurrentSchedule', - type: { - name: 'Composite', - className: 'RecurrentSchedule', - modelProperties: { - timeZone: { - required: true, - serializedName: 'timeZone', - type: { - name: 'String' - } - }, - days: { - required: true, - serializedName: 'days', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - hours: { - required: true, - serializedName: 'hours', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - }, - minutes: { - required: true, - serializedName: 'minutes', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - } - } - } - }; - } -} - -module.exports = RecurrentSchedule; diff --git a/lib/services/monitor/lib/lib/models/resource.js b/lib/services/monitor/lib/lib/models/resource.js deleted file mode 100644 index 429ae3a958..0000000000 --- a/lib/services/monitor/lib/lib/models/resource.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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'); - -/** - * An azure resource object - * - * @extends models['BaseResource'] - */ -class Resource extends models['BaseResource'] { - /** - * Create a Resource. - * @member {string} [id] Azure resource Id - * @member {string} [name] Azure resource name - * @member {string} [type] Azure resource type - * @member {string} location Resource location - * @member {object} [tags] Resource tags - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Resource - * - * @returns {object} metadata of Resource - * - */ - mapper() { - return { - required: false, - serializedName: 'Resource', - type: { - name: 'Composite', - className: 'Resource', - 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' - } - } - } - } - } - } - }; - } -} - -module.exports = Resource; diff --git a/lib/services/monitor/lib/lib/models/response.js b/lib/services/monitor/lib/lib/models/response.js deleted file mode 100644 index 20e0c9cbb3..0000000000 --- a/lib/services/monitor/lib/lib/models/response.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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 response to a metrics query. - * - */ -class Response { - /** - * Create a Response. - * @member {number} [cost] The integer value representing the cost of the - * query, for data case. - * @member {string} timespan The timespan for which the data was retrieved. - * Its value consists of two datatimes concatenated, separated by '/'. This - * may be adjusted in the future and returned back from what was originally - * requested. - * @member {moment.duration} [interval] The interval (window size) for which - * the metric data was returned in. This may be adjusted in the future and - * returned back from what was originally requested. This is not present if - * a metadata request was made. - * @member {string} [namespace] The namespace of the metrics been queried - * @member {string} [resourceregion] The region of the resource been queried - * for metrics. - * @member {array} value the value of the collection. - */ - constructor() { - } - - /** - * Defines the metadata of Response - * - * @returns {object} metadata of Response - * - */ - mapper() { - return { - required: false, - serializedName: 'Response', - type: { - name: 'Composite', - className: 'Response', - modelProperties: { - cost: { - required: false, - serializedName: 'cost', - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: 'Number' - } - }, - timespan: { - required: true, - serializedName: 'timespan', - type: { - name: 'String' - } - }, - interval: { - required: false, - serializedName: 'interval', - type: { - name: 'TimeSpan' - } - }, - namespace: { - required: false, - serializedName: 'namespace', - type: { - name: 'String' - } - }, - resourceregion: { - required: false, - serializedName: 'resourceregion', - type: { - name: 'String' - } - }, - value: { - required: true, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricElementType', - type: { - name: 'Composite', - className: 'Metric' - } - } - } - } - } - } - }; - } -} - -module.exports = Response; diff --git a/lib/services/monitor/lib/lib/models/retentionPolicy.js b/lib/services/monitor/lib/lib/models/retentionPolicy.js deleted file mode 100644 index 1ae39bed86..0000000000 --- a/lib/services/monitor/lib/lib/models/retentionPolicy.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 retention policy for the log. - * - */ -class RetentionPolicy { - /** - * Create a RetentionPolicy. - * @member {boolean} enabled a value indicating whether the retention policy - * is enabled. - * @member {number} days the number of days for the retention in days. A - * value of 0 will retain the events indefinitely. - */ - constructor() { - } - - /** - * Defines the metadata of RetentionPolicy - * - * @returns {object} metadata of RetentionPolicy - * - */ - mapper() { - return { - required: false, - serializedName: 'RetentionPolicy', - type: { - name: 'Composite', - className: 'RetentionPolicy', - modelProperties: { - enabled: { - required: true, - serializedName: 'enabled', - type: { - name: 'Boolean' - } - }, - days: { - required: true, - serializedName: 'days', - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = RetentionPolicy; diff --git a/lib/services/monitor/lib/lib/models/ruleAction.js b/lib/services/monitor/lib/lib/models/ruleAction.js deleted file mode 100644 index 8cc7f75b03..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleAction.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 action that is performed when the alert rule becomes active, and when an - * alert condition is resolved. - * - */ -class RuleAction { - /** - * Create a RuleAction. - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of RuleAction - * - * @returns {object} metadata of RuleAction - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleAction', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleAction', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleAction; diff --git a/lib/services/monitor/lib/lib/models/ruleCondition.js b/lib/services/monitor/lib/lib/models/ruleCondition.js deleted file mode 100644 index 5b43f85397..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleCondition.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 alert rule being activated. - * - */ -class RuleCondition { - /** - * Create a RuleCondition. - * @member {object} [dataSource] the resource from which the rule collects - * its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * @member {string} [dataSource.resourceUri] the resource identifier of the - * resource the rule monitors. **NOTE**: this property cannot be updated for - * an existing rule. - * @member {string} [dataSource.odatatype] Polymorphic Discriminator - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of RuleCondition - * - * @returns {object} metadata of RuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'RuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleCondition; diff --git a/lib/services/monitor/lib/lib/models/ruleDataSource.js b/lib/services/monitor/lib/lib/models/ruleDataSource.js deleted file mode 100644 index f106206ee3..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleDataSource.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 resource from which the rule collects its data. - * - */ -class RuleDataSource { - /** - * Create a RuleDataSource. - * @member {string} [resourceUri] the resource identifier of the resource the - * rule monitors. **NOTE**: this property cannot be updated for an existing - * rule. - * @member {string} odatatype Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of RuleDataSource - * - * @returns {object} metadata of RuleDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleDataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource', - modelProperties: { - resourceUri: { - required: false, - serializedName: 'resourceUri', - type: { - name: 'String' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleEmailAction.js b/lib/services/monitor/lib/lib/models/ruleEmailAction.js deleted file mode 100644 index 7a5a3b4e66..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleEmailAction.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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'); - -/** - * Specifies the action to send email when the rule condition is evaluated. The - * discriminator is always RuleEmailAction in this case. - * - * @extends models['RuleAction'] - */ -class RuleEmailAction extends models['RuleAction'] { - /** - * Create a RuleEmailAction. - * @member {boolean} [sendToServiceOwners] Whether the administrators - * (service and co-administrators) of the service should be notified when the - * alert is activated. - * @member {array} [customEmails] the list of administrator's custom email - * addresses to notify of the activation of the alert. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleEmailAction - * - * @returns {object} metadata of RuleEmailAction - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleEmailAction', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - sendToServiceOwners: { - required: false, - serializedName: 'sendToServiceOwners', - type: { - name: 'Boolean' - } - }, - customEmails: { - required: false, - serializedName: 'customEmails', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = RuleEmailAction; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js deleted file mode 100644 index a8a5de752c..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleManagementEventClaimsDataSource.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 claims for a rule management event data source. - * - */ -class RuleManagementEventClaimsDataSource { - /** - * Create a RuleManagementEventClaimsDataSource. - * @member {string} [emailAddress] the email address. - */ - constructor() { - } - - /** - * Defines the metadata of RuleManagementEventClaimsDataSource - * - * @returns {object} metadata of RuleManagementEventClaimsDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'RuleManagementEventClaimsDataSource', - type: { - name: 'Composite', - className: 'RuleManagementEventClaimsDataSource', - modelProperties: { - emailAddress: { - required: false, - serializedName: 'emailAddress', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleManagementEventClaimsDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js b/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js deleted file mode 100644 index b981085f6d..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleManagementEventDataSource.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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'); - -/** - * A rule management event data source. The discriminator fields is always - * RuleManagementEventDataSource in this case. - * - * @extends models['RuleDataSource'] - */ -class RuleManagementEventDataSource extends models['RuleDataSource'] { - /** - * Create a RuleManagementEventDataSource. - * @member {string} [eventName] the event name. - * @member {string} [eventSource] the event source. - * @member {string} [level] the level. - * @member {string} [operationName] The name of the operation that should be - * checked for. If no name is provided, any operation will match. - * @member {string} [resourceGroupName] the resource group name. - * @member {string} [resourceProviderName] the resource provider name. - * @member {string} [status] The status of the operation that should be - * checked for. If no status is provided, any status will match. - * @member {string} [subStatus] the substatus. - * @member {object} [claims] the claims. - * @member {string} [claims.emailAddress] the email address. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleManagementEventDataSource - * - * @returns {object} metadata of RuleManagementEventDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleManagementEventDataSource', - modelProperties: { - resourceUri: { - required: false, - serializedName: 'resourceUri', - type: { - name: 'String' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - eventName: { - required: false, - serializedName: 'eventName', - type: { - name: 'String' - } - }, - eventSource: { - required: false, - serializedName: 'eventSource', - type: { - name: 'String' - } - }, - level: { - required: false, - serializedName: 'level', - type: { - name: 'String' - } - }, - operationName: { - required: false, - serializedName: 'operationName', - type: { - name: 'String' - } - }, - resourceGroupName: { - required: false, - serializedName: 'resourceGroupName', - type: { - name: 'String' - } - }, - resourceProviderName: { - required: false, - serializedName: 'resourceProviderName', - type: { - name: 'String' - } - }, - status: { - required: false, - serializedName: 'status', - type: { - name: 'String' - } - }, - subStatus: { - required: false, - serializedName: 'subStatus', - type: { - name: 'String' - } - }, - claims: { - required: false, - serializedName: 'claims', - type: { - name: 'Composite', - className: 'RuleManagementEventClaimsDataSource' - } - } - } - } - }; - } -} - -module.exports = RuleManagementEventDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js b/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js deleted file mode 100644 index abf2f6aae1..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleMetricDataSource.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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'); - -/** - * A rule metric data source. The discriminator value is always - * RuleMetricDataSource in this case. - * - * @extends models['RuleDataSource'] - */ -class RuleMetricDataSource extends models['RuleDataSource'] { - /** - * Create a RuleMetricDataSource. - * @member {string} [metricName] the name of the metric that defines what the - * rule monitors. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleMetricDataSource - * - * @returns {object} metadata of RuleMetricDataSource - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleMetricDataSource', - modelProperties: { - resourceUri: { - required: false, - serializedName: 'resourceUri', - type: { - name: 'String' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - metricName: { - required: false, - serializedName: 'metricName', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RuleMetricDataSource; diff --git a/lib/services/monitor/lib/lib/models/ruleWebhookAction.js b/lib/services/monitor/lib/lib/models/ruleWebhookAction.js deleted file mode 100644 index 58cf335564..0000000000 --- a/lib/services/monitor/lib/lib/models/ruleWebhookAction.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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'); - -/** - * Specifies the action to post to service when the rule condition is - * evaluated. The discriminator is always RuleWebhookAction in this case. - * - * @extends models['RuleAction'] - */ -class RuleWebhookAction extends models['RuleAction'] { - /** - * Create a RuleWebhookAction. - * @member {string} [serviceUri] the service uri to Post the notification - * when the alert activates or resolves. - * @member {object} [properties] the dictionary of custom properties to - * include with the post operation. These data are appended to the webhook - * payload. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of RuleWebhookAction - * - * @returns {object} metadata of RuleWebhookAction - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.RuleWebhookAction', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleAction', - className: 'RuleWebhookAction', - modelProperties: { - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - serviceUri: { - required: false, - serializedName: 'serviceUri', - type: { - name: 'String' - } - }, - properties: { - required: false, - serializedName: 'properties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = RuleWebhookAction; diff --git a/lib/services/monitor/lib/lib/models/scaleAction.js b/lib/services/monitor/lib/lib/models/scaleAction.js deleted file mode 100644 index e07a8a5d27..0000000000 --- a/lib/services/monitor/lib/lib/models/scaleAction.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 parameters for the scaling action. - * - */ -class ScaleAction { - /** - * Create a ScaleAction. - * @member {string} direction the scale direction. Whether the scaling action - * increases or decreases the number of instances. Possible values include: - * 'None', 'Increase', 'Decrease' - * @member {string} type the type of action that should occur when the scale - * rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', - * 'ExactCount' - * @member {string} [value] the number of instances that are involved in the - * scaling action. This value must be 1 or greater. The default value is 1. - * Default value: '1' . - * @member {moment.duration} cooldown the amount of time to wait since the - * last scaling action before this action occurs. It must be between 1 week - * and 1 minute in ISO 8601 format. - */ - constructor() { - } - - /** - * Defines the metadata of ScaleAction - * - * @returns {object} metadata of ScaleAction - * - */ - mapper() { - return { - required: false, - serializedName: 'ScaleAction', - type: { - name: 'Composite', - className: 'ScaleAction', - modelProperties: { - direction: { - required: true, - serializedName: 'direction', - type: { - name: 'Enum', - allowedValues: [ 'None', 'Increase', 'Decrease' ] - } - }, - type: { - required: true, - serializedName: 'type', - type: { - name: 'Enum', - allowedValues: [ 'ChangeCount', 'PercentChangeCount', 'ExactCount' ] - } - }, - value: { - required: false, - serializedName: 'value', - defaultValue: '1', - type: { - name: 'String' - } - }, - cooldown: { - required: true, - serializedName: 'cooldown', - type: { - name: 'TimeSpan' - } - } - } - } - }; - } -} - -module.exports = ScaleAction; diff --git a/lib/services/monitor/lib/lib/models/scaleCapacity.js b/lib/services/monitor/lib/lib/models/scaleCapacity.js deleted file mode 100644 index 841ec3393c..0000000000 --- a/lib/services/monitor/lib/lib/models/scaleCapacity.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 number of instances that can be used during this profile. - * - */ -class ScaleCapacity { - /** - * Create a ScaleCapacity. - * @member {string} minimum the minimum number of instances for the resource. - * @member {string} maximum the maximum number of instances for the resource. - * The actual maximum number of instances is limited by the cores that are - * available in the subscription. - * @member {string} default the number of instances that will be set if - * metrics are not available for evaluation. The default is only used if the - * current instance count is lower than the default. - */ - constructor() { - } - - /** - * Defines the metadata of ScaleCapacity - * - * @returns {object} metadata of ScaleCapacity - * - */ - mapper() { - return { - required: false, - serializedName: 'ScaleCapacity', - type: { - name: 'Composite', - className: 'ScaleCapacity', - modelProperties: { - minimum: { - required: true, - serializedName: 'minimum', - type: { - name: 'String' - } - }, - maximum: { - required: true, - serializedName: 'maximum', - type: { - name: 'String' - } - }, - default: { - required: true, - serializedName: 'default', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ScaleCapacity; diff --git a/lib/services/monitor/lib/lib/models/scaleRule.js b/lib/services/monitor/lib/lib/models/scaleRule.js deleted file mode 100644 index 0836d498c2..0000000000 --- a/lib/services/monitor/lib/lib/models/scaleRule.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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'); - -/** - * A rule that provide the triggers and parameters for the scaling action. - * - */ -class ScaleRule { - /** - * Create a ScaleRule. - * @member {object} metricTrigger the trigger that results in a scaling - * action. - * @member {string} [metricTrigger.metricName] the name of the metric that - * defines what the rule monitors. - * @member {string} [metricTrigger.metricResourceUri] the resource identifier - * of the resource the rule monitors. - * @member {moment.duration} [metricTrigger.timeGrain] the granularity of - * metrics the rule monitors. Must be one of the predefined values returned - * from metric definitions for the metric. Must be between 12 hours and 1 - * minute. - * @member {string} [metricTrigger.statistic] the metric statistic type. How - * the metrics from multiple instances are combined. Possible values include: - * 'Average', 'Min', 'Max', 'Sum' - * @member {moment.duration} [metricTrigger.timeWindow] the range of time in - * which instance data is collected. This value must be greater than the - * delay in metric collection, which can vary from resource-to-resource. Must - * be between 12 hours and 5 minutes. - * @member {string} [metricTrigger.timeAggregation] time aggregation type. - * How the data that is collected should be combined over time. The default - * value is Average. Possible values include: 'Average', 'Minimum', - * 'Maximum', 'Total', 'Count' - * @member {string} [metricTrigger.operator] the operator that is used to - * compare the metric data and the threshold. Possible values include: - * 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - * 'LessThanOrEqual' - * @member {number} [metricTrigger.threshold] the threshold of the metric - * that triggers the scale action. - * @member {object} scaleAction the parameters for the scaling action. - * @member {string} [scaleAction.direction] the scale direction. Whether the - * scaling action increases or decreases the number of instances. Possible - * values include: 'None', 'Increase', 'Decrease' - * @member {string} [scaleAction.type] the type of action that should occur - * when the scale rule fires. Possible values include: 'ChangeCount', - * 'PercentChangeCount', 'ExactCount' - * @member {string} [scaleAction.value] the number of instances that are - * involved in the scaling action. This value must be 1 or greater. The - * default value is 1. - * @member {moment.duration} [scaleAction.cooldown] the amount of time to - * wait since the last scaling action before this action occurs. It must be - * between 1 week and 1 minute in ISO 8601 format. - */ - constructor() { - } - - /** - * Defines the metadata of ScaleRule - * - * @returns {object} metadata of ScaleRule - * - */ - mapper() { - return { - required: false, - serializedName: 'ScaleRule', - type: { - name: 'Composite', - className: 'ScaleRule', - modelProperties: { - metricTrigger: { - required: true, - serializedName: 'metricTrigger', - type: { - name: 'Composite', - className: 'MetricTrigger' - } - }, - scaleAction: { - required: true, - serializedName: 'scaleAction', - type: { - name: 'Composite', - className: 'ScaleAction' - } - } - } - } - }; - } -} - -module.exports = ScaleRule; diff --git a/lib/services/monitor/lib/lib/models/senderAuthorization.js b/lib/services/monitor/lib/lib/models/senderAuthorization.js deleted file mode 100644 index db357336e2..0000000000 --- a/lib/services/monitor/lib/lib/models/senderAuthorization.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 authorization used by the user who has performed the operation that led - * to this event. This captures the RBAC properties of the event. These usually - * include the 'action', 'role' and the 'scope' - * - */ -class SenderAuthorization { - /** - * Create a SenderAuthorization. - * @member {string} [action] the permissible actions. For instance: - * microsoft.support/supporttickets/write - * @member {string} [role] the role of the user. For instance: Subscription - * Admin - * @member {string} [scope] the scope. - */ - constructor() { - } - - /** - * Defines the metadata of SenderAuthorization - * - * @returns {object} metadata of SenderAuthorization - * - */ - mapper() { - return { - required: false, - serializedName: 'SenderAuthorization', - type: { - name: 'Composite', - className: 'SenderAuthorization', - modelProperties: { - action: { - required: false, - serializedName: 'action', - type: { - name: 'String' - } - }, - role: { - required: false, - serializedName: 'role', - type: { - name: 'String' - } - }, - scope: { - required: false, - serializedName: 'scope', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = SenderAuthorization; diff --git a/lib/services/monitor/lib/lib/models/smsReceiver.js b/lib/services/monitor/lib/lib/models/smsReceiver.js deleted file mode 100644 index 9579690c9e..0000000000 --- a/lib/services/monitor/lib/lib/models/smsReceiver.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 SMS receiver. - * - */ -class SmsReceiver { - /** - * Create a SmsReceiver. - * @member {string} name The name of the SMS receiver. Names must be unique - * across all receivers within an action group. - * @member {string} countryCode The country code of the SMS receiver. - * @member {string} phoneNumber The phone number of the SMS receiver. - * @member {string} [status] The status of the receiver. Possible values - * include: 'NotSpecified', 'Enabled', 'Disabled' - */ - constructor() { - } - - /** - * Defines the metadata of SmsReceiver - * - * @returns {object} metadata of SmsReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'SmsReceiver', - type: { - name: 'Composite', - className: 'SmsReceiver', - 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' - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'NotSpecified', 'Enabled', 'Disabled' ] - } - } - } - } - }; - } -} - -module.exports = SmsReceiver; diff --git a/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js b/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js deleted file mode 100644 index 899822bb45..0000000000 --- a/lib/services/monitor/lib/lib/models/thresholdRuleCondition.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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'); - -/** - * A rule condition based on a metric crossing a threshold. - * - * @extends models['RuleCondition'] - */ -class ThresholdRuleCondition extends models['RuleCondition'] { - /** - * Create a ThresholdRuleCondition. - * @member {string} operator the operator used to compare the data and the - * threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', - * 'LessThan', 'LessThanOrEqual' - * @member {number} threshold the threshold value that activates the alert. - * @member {moment.duration} [windowSize] the period of time (in ISO 8601 - * duration format) that is used to monitor alert activity based on the - * threshold. If specified then it must be between 5 minutes and 1 day. - * @member {string} [timeAggregation] the time aggregation operator. How the - * data that are collected should be combined over time. The default value is - * the PrimaryAggregationType of the Metric. Possible values include: - * 'Average', 'Minimum', 'Maximum', 'Total', 'Last' - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ThresholdRuleCondition - * - * @returns {object} metadata of ThresholdRuleCondition - * - */ - mapper() { - return { - required: false, - serializedName: 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleCondition', - className: 'ThresholdRuleCondition', - modelProperties: { - dataSource: { - required: false, - serializedName: 'dataSource', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'odata.type', - clientName: 'odatatype' - }, - uberParent: 'RuleDataSource', - className: 'RuleDataSource' - } - }, - odatatype: { - required: true, - serializedName: 'odata\\.type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - operator: { - required: true, - serializedName: 'operator', - type: { - name: 'Enum', - allowedValues: [ 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' ] - } - }, - threshold: { - required: true, - serializedName: 'threshold', - type: { - name: 'Number' - } - }, - windowSize: { - required: false, - serializedName: 'windowSize', - type: { - name: 'TimeSpan' - } - }, - timeAggregation: { - required: false, - serializedName: 'timeAggregation', - type: { - name: 'Enum', - allowedValues: [ 'Average', 'Minimum', 'Maximum', 'Total', 'Last' ] - } - } - } - } - }; - } -} - -module.exports = ThresholdRuleCondition; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesElement.js b/lib/services/monitor/lib/lib/models/timeSeriesElement.js deleted file mode 100644 index 576f5a51ab..0000000000 --- a/lib/services/monitor/lib/lib/models/timeSeriesElement.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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'); - -/** - * A time series result type. The discriminator value is always TimeSeries in - * this case. - * - */ -class TimeSeriesElement { - /** - * Create a TimeSeriesElement. - * @member {array} [metadatavalues] the metadata values returned if $filter - * was specified in the call. - * @member {array} [data] An array of data points representing the metric - * values. This is only returned if a result type of data is specified. - */ - constructor() { - } - - /** - * Defines the metadata of TimeSeriesElement - * - * @returns {object} metadata of TimeSeriesElement - * - */ - mapper() { - return { - required: false, - serializedName: 'TimeSeriesElement', - type: { - name: 'Composite', - className: 'TimeSeriesElement', - modelProperties: { - metadatavalues: { - required: false, - serializedName: 'metadatavalues', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetadataValueElementType', - type: { - name: 'Composite', - className: 'MetadataValue' - } - } - } - }, - data: { - required: false, - serializedName: 'data', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'MetricValueElementType', - type: { - name: 'Composite', - className: 'MetricValue' - } - } - } - } - } - } - }; - } -} - -module.exports = TimeSeriesElement; diff --git a/lib/services/monitor/lib/lib/models/timeSeriesInformation.js b/lib/services/monitor/lib/lib/models/timeSeriesInformation.js deleted file mode 100644 index f4d8ac5464..0000000000 --- a/lib/services/monitor/lib/lib/models/timeSeriesInformation.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 time series info needed for calculating the baseline. - * - */ -class TimeSeriesInformation { - /** - * Create a TimeSeriesInformation. - * @member {array} sensitivities the list of sensitivities for calculating - * the baseline. - * @member {array} values The metric values to calculate the baseline. - * @member {array} [timestamps] the array of timestamps of the baselines. - */ - constructor() { - } - - /** - * Defines the metadata of TimeSeriesInformation - * - * @returns {object} metadata of TimeSeriesInformation - * - */ - mapper() { - return { - required: false, - serializedName: 'TimeSeriesInformation', - type: { - name: 'Composite', - className: 'TimeSeriesInformation', - modelProperties: { - sensitivities: { - required: true, - serializedName: 'sensitivities', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - values: { - required: true, - serializedName: 'values', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'NumberElementType', - type: { - name: 'Number' - } - } - } - }, - timestamps: { - required: false, - serializedName: 'timestamps', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'DateElementType', - type: { - name: 'DateTime' - } - } - } - } - } - } - }; - } -} - -module.exports = TimeSeriesInformation; diff --git a/lib/services/monitor/lib/lib/models/timeWindow.js b/lib/services/monitor/lib/lib/models/timeWindow.js deleted file mode 100644 index c072fd288a..0000000000 --- a/lib/services/monitor/lib/lib/models/timeWindow.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 specific date-time for the profile. - * - */ -class TimeWindow { - /** - * Create a TimeWindow. - * @member {string} [timeZone] the timezone of the start and end times for - * the profile. Some examples of valid timezones are: Dateline Standard Time, - * UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard - * Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - * Standard Time (Mexico), Mountain Standard Time, Central America Standard - * Time, Central Standard Time, Central Standard Time (Mexico), Canada - * Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US - * Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - * Atlantic Standard Time, Central Brazilian Standard Time, SA Western - * Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. - * South America Standard Time, Argentina Standard Time, SA Eastern Standard - * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard - * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - * Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich - * Standard Time, W. Europe Standard Time, Central Europe Standard Time, - * Romance Standard Time, Central European Standard Time, W. Central Africa - * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - * E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, - * Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, - * Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - * Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - * Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia - * Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus - * Standard Time, Afghanistan Standard Time, West Asia Standard Time, - * Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - * Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, - * Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - * Time, SE Asia Standard Time, North Asia Standard Time, China Standard - * Time, North Asia East Standard Time, Singapore Standard Time, W. Australia - * Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo - * Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia - * Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS - * Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, - * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard - * Time, Samoa Standard Time, Line Islands Standard Time - * @member {date} start the start time for the profile in ISO 8601 format. - * @member {date} end the end time for the profile in ISO 8601 format. - */ - constructor() { - } - - /** - * Defines the metadata of TimeWindow - * - * @returns {object} metadata of TimeWindow - * - */ - mapper() { - return { - required: false, - serializedName: 'TimeWindow', - type: { - name: 'Composite', - className: 'TimeWindow', - modelProperties: { - timeZone: { - required: false, - serializedName: 'timeZone', - type: { - name: 'String' - } - }, - start: { - required: true, - serializedName: 'start', - type: { - name: 'DateTime' - } - }, - end: { - required: true, - serializedName: 'end', - type: { - name: 'DateTime' - } - } - } - } - }; - } -} - -module.exports = TimeWindow; diff --git a/lib/services/monitor/lib/lib/models/voiceReceiver.js b/lib/services/monitor/lib/lib/models/voiceReceiver.js deleted file mode 100644 index ac1ac1025d..0000000000 --- a/lib/services/monitor/lib/lib/models/voiceReceiver.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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/monitor/lib/lib/models/webhookNotification.js b/lib/services/monitor/lib/lib/models/webhookNotification.js deleted file mode 100644 index bc05f4b1a1..0000000000 --- a/lib/services/monitor/lib/lib/models/webhookNotification.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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'; - -/** - * Webhook notification of an autoscale event. - * - */ -class WebhookNotification { - /** - * Create a WebhookNotification. - * @member {string} [serviceUri] the service address to receive the - * notification. - * @member {object} [properties] a property bag of settings. This value can - * be empty. - */ - constructor() { - } - - /** - * Defines the metadata of WebhookNotification - * - * @returns {object} metadata of WebhookNotification - * - */ - mapper() { - return { - required: false, - serializedName: 'WebhookNotification', - type: { - name: 'Composite', - className: 'WebhookNotification', - modelProperties: { - serviceUri: { - required: false, - serializedName: 'serviceUri', - type: { - name: 'String' - } - }, - properties: { - required: false, - serializedName: 'properties', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = WebhookNotification; diff --git a/lib/services/monitor/lib/lib/models/webhookReceiver.js b/lib/services/monitor/lib/lib/models/webhookReceiver.js deleted file mode 100644 index bfaf7cd202..0000000000 --- a/lib/services/monitor/lib/lib/models/webhookReceiver.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 webhook receiver. - * - */ -class WebhookReceiver { - /** - * Create a WebhookReceiver. - * @member {string} name The name of the webhook receiver. Names must be - * unique across all receivers within an action group. - * @member {string} serviceUri The URI where webhooks should be sent. - */ - constructor() { - } - - /** - * Defines the metadata of WebhookReceiver - * - * @returns {object} metadata of WebhookReceiver - * - */ - mapper() { - return { - required: false, - serializedName: 'WebhookReceiver', - type: { - name: 'Composite', - className: 'WebhookReceiver', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - serviceUri: { - required: true, - serializedName: 'serviceUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = WebhookReceiver; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.d.ts b/lib/services/monitor/lib/lib/monitorManagementClient.d.ts deleted file mode 100644 index 9c64e133dc..0000000000 --- a/lib/services/monitor/lib/lib/monitorManagementClient.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { ServiceClientCredentials } from 'ms-rest'; -import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; -import * as models from "./models"; -import * as operations from "./operations"; - -export default class MonitorManagementClient extends AzureServiceClient { - /** - * Initializes a new instance of the MonitorManagementClient class. - * @constructor - * - * @class - * @param {credentials} credentials - Credentials needed for the client to connect to Azure. - * - * @param {string} subscriptionId - The Azure subscription Id. - * - * @param {string} [baseUri] - The base URI of the service. - * - * @param {object} [options] - The parameter options - * - * @param {Array} [options.filters] - Filters to be added to the request pipeline - * - * @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. - * - */ - constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); - - credentials: ServiceClientCredentials; - - subscriptionId: string; - - acceptLanguage: string; - - longRunningOperationRetryTimeout: number; - - generateClientRequestId: boolean; - - // Operation groups - autoscaleSettings: operations.AutoscaleSettings; - operations: operations.Operations; - alertRuleIncidents: operations.AlertRuleIncidents; - alertRules: operations.AlertRules; - logProfiles: operations.LogProfiles; - diagnosticSettingsOperations: operations.DiagnosticSettingsOperations; - diagnosticSettingsCategoryOperations: operations.DiagnosticSettingsCategoryOperations; - actionGroups: operations.ActionGroups; - activityLogAlerts: operations.ActivityLogAlerts; - activityLogs: operations.ActivityLogs; - eventCategories: operations.EventCategories; - tenantActivityLogs: operations.TenantActivityLogs; - metricDefinitions: operations.MetricDefinitions; - metrics: operations.Metrics; - metricBaseline: operations.MetricBaseline; - metricAlerts: operations.MetricAlerts; - metricAlertsStatus: operations.MetricAlertsStatus; -} - -export { MonitorManagementClient, models as MonitorManagementModels }; diff --git a/lib/services/monitor/lib/lib/monitorManagementClient.js b/lib/services/monitor/lib/lib/monitorManagementClient.js deleted file mode 100644 index 356cd3c461..0000000000 --- a/lib/services/monitor/lib/lib/monitorManagementClient.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -const msRest = require('ms-rest'); -const msRestAzure = require('ms-rest-azure'); -const ServiceClient = msRestAzure.AzureServiceClient; - -const models = require('./models'); -const operations = require('./operations'); - - -/** Class representing a MonitorManagementClient. */ -class MonitorManagementClient extends ServiceClient { - /** - * Create a MonitorManagementClient. - * @param {credentials} credentials - Credentials needed for the client to connect to Azure. - * @param {string} subscriptionId - The Azure subscription Id. - * @param {string} [baseUri] - The base URI of the service. - * @param {object} [options] - The parameter options - * @param {Array} [options.filters] - Filters to be added to the request pipeline - * @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. - */ - constructor(credentials, subscriptionId, baseUri, options) { - if (credentials === null || credentials === undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId === null || subscriptionId === undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) options = {}; - - super(credentials, options); - - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.generateClientRequestId = true; - this.baseUri = baseUri; - if (!this.baseUri) { - this.baseUri = 'https://management.azure.com'; - } - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - let packageInfo = this.getPackageJsonInfo(__dirname); - this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { - this.generateClientRequestId = options.generateClientRequestId; - } - this.autoscaleSettings = new operations.AutoscaleSettings(this); - this.operations = new operations.Operations(this); - this.alertRuleIncidents = new operations.AlertRuleIncidents(this); - this.alertRules = new operations.AlertRules(this); - this.logProfiles = new operations.LogProfiles(this); - this.diagnosticSettingsOperations = new operations.DiagnosticSettingsOperations(this); - this.diagnosticSettingsCategoryOperations = new operations.DiagnosticSettingsCategoryOperations(this); - this.actionGroups = new operations.ActionGroups(this); - this.activityLogAlerts = new operations.ActivityLogAlerts(this); - this.activityLogs = new operations.ActivityLogs(this); - this.eventCategories = new operations.EventCategories(this); - this.tenantActivityLogs = new operations.TenantActivityLogs(this); - this.metricDefinitions = new operations.MetricDefinitions(this); - this.metrics = new operations.Metrics(this); - this.metricBaseline = new operations.MetricBaseline(this); - this.metricAlerts = new operations.MetricAlerts(this); - this.metricAlertsStatus = new operations.MetricAlertsStatus(this); - this.models = models; - msRest.addSerializationMixin(this); - } - -} - -module.exports = MonitorManagementClient; -module.exports['default'] = MonitorManagementClient; -module.exports.MonitorManagementClient = MonitorManagementClient; -module.exports.MonitorManagementModels = models; diff --git a/lib/services/monitor/lib/lib/operations/actionGroups.js b/lib/services/monitor/lib/lib/operations/actionGroups.js deleted file mode 100644 index 5c41c3e997..0000000000 --- a/lib/services/monitor/lib/lib/operations/actionGroups.js +++ /dev/null @@ -1,1810 +0,0 @@ -/* - * 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; - -/** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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 ActionGroupResource} 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, actionGroupName, actionGroup, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); - } - if (actionGroup === null || actionGroup === undefined) { - throw new Error('actionGroup cannot be null or undefined.'); - } - 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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 = '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 (actionGroup !== null && actionGroup !== undefined) { - let requestModelMapper = new client.models['ActionGroupResource']().mapper(); - requestModel = client.serialize(requestModelMapper, actionGroup, 'actionGroup'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(actionGroup, 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['ActionGroupResource']().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['ActionGroupResource']().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); - }); -} - -/** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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 ActionGroupResource} 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, actionGroupName, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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['ActionGroupResource']().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); - }); -} - -/** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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); - }); -} - -/** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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-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 (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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName cannot be null or undefined and it must be of type string.'); - } - if (actionGroupPatch === null || actionGroupPatch === undefined) { - throw new Error('actionGroupPatch 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/actionGroups/{actionGroupName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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 (actionGroupPatch !== null && actionGroupPatch !== undefined) { - let requestModelMapper = new client.models['ActionGroupPatchBody']().mapper(); - requestModel = client.serialize(requestModelMapper, actionGroupPatch, 'actionGroupPatch'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(actionGroupPatch, 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['ActionGroupResource']().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); - }); -} - -/** - * Get a list of all action groups in 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 ActionGroupList} 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 _listBySubscriptionId(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-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/actionGroups'; - 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['ActionGroupList']().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); - }); -} - -/** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 ActionGroupList} 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 apiVersion = '2018-03-01'; - // 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 (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/actionGroups'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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['ActionGroupList']().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); - }); -} - -/** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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 _enableReceiver(resourceGroupName, actionGroupName, receiverName, 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-03-01'; - // 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 (actionGroupName === null || actionGroupName === undefined || typeof actionGroupName.valueOf() !== 'string') { - throw new Error('actionGroupName 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 (receiverName === null || receiverName === undefined || typeof receiverName.valueOf() !== 'string') { - throw new Error('receiverName 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); - } - let enableRequest; - if (receiverName !== null && receiverName !== undefined) { - enableRequest = new client.models['EnableRequest'](); - enableRequest.receiverName = receiverName; - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{actionGroupName}', encodeURIComponent(actionGroupName)); - 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 = 'POST'; - 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 (enableRequest !== null && enableRequest !== undefined) { - let requestModelMapper = new client.models['EnableRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, enableRequest, 'enableRequest'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(enableRequest, 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 !== 409) { - 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); - }); -} - -/** Class representing a ActionGroups. */ -class ActionGroups { - /** - * Create a ActionGroups. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._update = _update; - this._listBySubscriptionId = _listBySubscriptionId; - this._listByResourceGroup = _listByResourceGroup; - this._enableReceiver = _enableReceiver; - } - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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, actionGroupName, actionGroup, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroup, 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, actionGroupName, actionGroup, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, actionGroupName, actionGroup, options, optionalCallback); - } - } - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, actionGroupName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, actionGroupName, options, optionalCallback); - } - } - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, actionGroupName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName, 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, actionGroupName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, actionGroupName, options, optionalCallback); - } - } - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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, actionGroupName, actionGroupPatch, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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 {ActionGroupResource} - 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 ActionGroupResource} 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, actionGroupName, actionGroupPatch, 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, actionGroupName, actionGroupPatch, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, actionGroupName, actionGroupPatch, options, optionalCallback); - } - } - - /** - * Get a list of all action groups in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listBySubscriptionId(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get a list of all action groups in 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 {ActionGroupList} - 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 ActionGroupList} 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. - */ - listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listBySubscriptionId(options, optionalCallback); - } - } - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActionGroupList} - 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 ActionGroupList} 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); - } - } - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiverWithHttpOperationResponse(resourceGroupName, actionGroupName, receiverName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiver(resourceGroupName, actionGroupName, receiverName, 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._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._enableReceiver(resourceGroupName, actionGroupName, receiverName, options, optionalCallback); - } - } - -} - -module.exports = ActionGroups; diff --git a/lib/services/monitor/lib/lib/operations/activityLogAlerts.js b/lib/services/monitor/lib/lib/operations/activityLogAlerts.js deleted file mode 100644 index bc6417b698..0000000000 --- a/lib/services/monitor/lib/lib/operations/activityLogAlerts.js +++ /dev/null @@ -1,1543 +0,0 @@ -/* - * 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; - -/** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); - } - if (activityLogAlert === null || activityLogAlert === undefined) { - throw new Error('activityLogAlert 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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 (activityLogAlert !== null && activityLogAlert !== undefined) { - let requestModelMapper = new client.models['ActivityLogAlertResource']().mapper(); - requestModel = client.serialize(requestModelMapper, activityLogAlert, 'activityLogAlert'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(activityLogAlert, 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['ActivityLogAlertResource']().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['ActivityLogAlertResource']().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); - }); -} - -/** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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 ActivityLogAlertResource} 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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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['ActivityLogAlertResource']().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); - }); -} - -/** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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); - }); -} - -/** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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 = '2017-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 (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 (activityLogAlertName === null || activityLogAlertName === undefined || typeof activityLogAlertName.valueOf() !== 'string') { - throw new Error('activityLogAlertName cannot be null or undefined and it must be of type string.'); - } - if (activityLogAlertPatch === null || activityLogAlertPatch === undefined) { - throw new Error('activityLogAlertPatch 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/activityLogAlerts/{activityLogAlertName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{activityLogAlertName}', encodeURIComponent(activityLogAlertName)); - 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 (activityLogAlertPatch !== null && activityLogAlertPatch !== undefined) { - let requestModelMapper = new client.models['ActivityLogAlertPatchBody']().mapper(); - requestModel = client.serialize(requestModelMapper, activityLogAlertPatch, 'activityLogAlertPatch'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(activityLogAlertPatch, 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['ActivityLogAlertResource']().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); - }); -} - -/** - * Get a list of all activity log alerts in 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 ActivityLogAlertList} 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 _listBySubscriptionId(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 = '2017-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/activityLogAlerts'; - 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['ActivityLogAlertList']().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); - }); -} - -/** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 ActivityLogAlertList} 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 apiVersion = '2017-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 (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 (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/activityLogAlerts'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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['ActivityLogAlertList']().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 ActivityLogAlerts. */ -class ActivityLogAlerts { - /** - * Create a ActivityLogAlerts. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._update = _update; - this._listBySubscriptionId = _listBySubscriptionId; - this._listByResourceGroup = _listByResourceGroup; - } - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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, activityLogAlertName, activityLogAlert, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlert, 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, activityLogAlertName, activityLogAlert, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options, optionalCallback); - } - } - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, activityLogAlertName, options, optionalCallback); - } - } - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, activityLogAlertName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName, 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, activityLogAlertName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, activityLogAlertName, options, optionalCallback); - } - } - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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, activityLogAlertName, activityLogAlertPatch, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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 {ActivityLogAlertResource} - 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 ActivityLogAlertResource} 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, activityLogAlertName, activityLogAlertPatch, 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, activityLogAlertName, activityLogAlertPatch, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options, optionalCallback); - } - } - - /** - * Get a list of all activity log alerts in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listBySubscriptionId(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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. - */ - listBySubscriptionId(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._listBySubscriptionId(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listBySubscriptionId(options, optionalCallback); - } - } - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActivityLogAlertList} - 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 ActivityLogAlertList} 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 = ActivityLogAlerts; diff --git a/lib/services/monitor/lib/lib/operations/activityLogs.js b/lib/services/monitor/lib/lib/operations/activityLogs.js deleted file mode 100644 index 7128d017ab..0000000000 --- a/lib/services/monitor/lib/lib/operations/activityLogs.js +++ /dev/null @@ -1,545 +0,0 @@ -/* - * 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; - -/** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; - let apiVersion = '2015-04-01'; - // Validate - try { - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); - } - if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { - throw new Error('select 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/eventtypes/management/values'; - 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 (select !== null && select !== undefined) { - queryParameters.push('$select=' + encodeURIComponent(select)); - } - 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['EventDataCollection']().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); - }); -} - -/** - * Provides the list of records from the activity logs. - * - * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 ActivityLogs. */ -class ActivityLogs { - /** - * Create a ActivityLogs. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listNext = _listNext; - } - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - - /** - * Provides the list of records from the activity logs. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Provides the list of records from the activity logs. - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listNext(nextPageLink, options, optionalCallback); - } - } - -} - -module.exports = ActivityLogs; diff --git a/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js b/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js deleted file mode 100644 index fac095135e..0000000000 --- a/lib/services/monitor/lib/lib/operations/alertRuleIncidents.js +++ /dev/null @@ -1,500 +0,0 @@ -/* - * 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; - -/** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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 Incident} 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, incidentName, 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 (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 (incidentName === null || incidentName === undefined || typeof incidentName.valueOf() !== 'string') { - throw new Error('incidentName 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/alertrules/{ruleName}/incidents/{incidentName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); - requestUrl = requestUrl.replace('{incidentName}', encodeURIComponent(incidentName)); - 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['Incident']().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); - }); -} - -/** - * Gets a list of incidents associated to an alert 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 IncidentListResult} 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 _listByAlertRule(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 = '2016-03-01'; - // 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/alertrules/{ruleName}/incidents'; - 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) { - 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['IncidentListResult']().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 AlertRuleIncidents. */ -class AlertRuleIncidents { - /** - * Create a AlertRuleIncidents. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._listByAlertRule = _listByAlertRule; - } - - /** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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, incidentName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, ruleName, incidentName, 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 incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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 {Incident} - 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 Incident} 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, incidentName, 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, incidentName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, ruleName, incidentName, options, optionalCallback); - } - } - - /** - * Gets a list of incidents associated to an alert 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. - */ - listByAlertRuleWithHttpOperationResponse(resourceGroupName, ruleName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByAlertRule(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 a list of incidents associated to an alert 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 {IncidentListResult} - 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 IncidentListResult} 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. - */ - listByAlertRule(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._listByAlertRule(resourceGroupName, ruleName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByAlertRule(resourceGroupName, ruleName, options, optionalCallback); - } - } - -} - -module.exports = AlertRuleIncidents; diff --git a/lib/services/monitor/lib/lib/operations/alertRules.js b/lib/services/monitor/lib/lib/operations/alertRules.js deleted file mode 100644 index 3676f74c97..0000000000 --- a/lib/services/monitor/lib/lib/operations/alertRules.js +++ /dev/null @@ -1,1423 +0,0 @@ -/* - * 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 alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 AlertRuleResource} 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 = '2016-03-01'; - // 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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - 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/alertrules/{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 = '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['AlertRuleResource']().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['AlertRuleResource']().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['AlertRuleResource']().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); - }); -} - -/** - * Deletes an alert 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 = '2016-03-01'; - // 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/alertrules/{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) { - 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; - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Gets an alert 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 AlertRuleResource} 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 = '2016-03-01'; - // 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/alertrules/{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) { - 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['AlertRuleResource']().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); - }); -} - -/** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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 AlertRuleResource} 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, alertRulesResource, 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 (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 (alertRulesResource === null || alertRulesResource === undefined) { - throw new Error('alertRulesResource 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/alertrules/{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 (alertRulesResource !== null && alertRulesResource !== undefined) { - let requestModelMapper = new client.models['AlertRuleResourcePatch']().mapper(); - requestModel = client.serialize(requestModelMapper, alertRulesResource, 'alertRulesResource'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(alertRulesResource, 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['AlertRuleResource']().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['AlertRuleResource']().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); - }); -} - -/** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 _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 apiVersion = '2016-03-01'; - // 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 (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/alertrules'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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 { - /** - * Create a AlertRules. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._update = _update; - this._listByResourceGroup = _listByResourceGroup; - } - - /** - * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {AlertRuleResource} - 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 AlertRuleResource} 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); - } - } - - /** - * Deletes an alert 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 an alert 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); - } - } - - /** - * Gets an alert 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 alert 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 {AlertRuleResource} - 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 AlertRuleResource} 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); - } - } - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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, alertRulesResource, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, ruleName, alertRulesResource, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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 {AlertRuleResource} - 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 AlertRuleResource} 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, alertRulesResource, 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, alertRulesResource, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, ruleName, alertRulesResource, options, optionalCallback); - } - } - - /** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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 alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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 = AlertRules; diff --git a/lib/services/monitor/lib/lib/operations/autoscaleSettings.js b/lib/services/monitor/lib/lib/operations/autoscaleSettings.js deleted file mode 100644 index a65507da16..0000000000 --- a/lib/services/monitor/lib/lib/operations/autoscaleSettings.js +++ /dev/null @@ -1,1561 +0,0 @@ -/* - * 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; - -/** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 _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 apiVersion = '2015-04-01'; - // 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 (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/autoscalesettings'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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); - }); -} - -/** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 = '2015-04-01'; - // 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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName 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.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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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 = '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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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['AutoscaleSettingResource']().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); - }); -} - -/** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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); - }); -} - -/** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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 AutoscaleSettingResource} 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, autoscaleSettingName, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName 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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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['AutoscaleSettingResource']().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); - }); -} - -/** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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 (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 (autoscaleSettingName === null || autoscaleSettingName === undefined || typeof autoscaleSettingName.valueOf() !== 'string') { - throw new Error('autoscaleSettingName cannot be null or undefined and it must be of type string.'); - } - if (autoscaleSettingResource === null || autoscaleSettingResource === undefined) { - throw new Error('autoscaleSettingResource 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/autoscalesettings/{autoscaleSettingName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{autoscaleSettingName}', encodeURIComponent(autoscaleSettingName)); - 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 (autoscaleSettingResource !== null && autoscaleSettingResource !== undefined) { - let requestModelMapper = new client.models['AutoscaleSettingResourcePatch']().mapper(); - requestModel = client.serialize(requestModelMapper, autoscaleSettingResource, 'autoscaleSettingResource'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(autoscaleSettingResource, 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['AutoscaleSettingResource']().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 - * - * @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 _listByResourceGroupNext(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 { - /** - * Create a AutoscaleSettings. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._listByResourceGroup = _listByResourceGroup; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._update = _update; - this._listByResourceGroupNext = _listByResourceGroupNext; - } - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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); - } - } - - /** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, autoscaleSettingName, 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 autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceGroupName, autoscaleSettingName, parameters, options, optionalCallback); - } - } - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, autoscaleSettingName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceGroupName, autoscaleSettingName, options, optionalCallback); - } - } - - /** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, autoscaleSettingName, 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 autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, 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, autoscaleSettingName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceGroupName, autoscaleSettingName, options, optionalCallback); - } - } - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName, autoscaleSettingResource, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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 AutoscaleSettingResource} 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, autoscaleSettingName, autoscaleSettingResource, 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, autoscaleSettingName, autoscaleSettingResource, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options, optionalCallback); - } - } - - /** - * Lists the autoscale settings for a resource group - * - * @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. - */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByResourceGroupNext(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 resource group - * - * @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. - */ - listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); - } - } - -} - -module.exports = AutoscaleSettings; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js deleted file mode 100644 index 551dd62984..0000000000 --- a/lib/services/monitor/lib/lib/operations/diagnosticSettingsCategoryOperations.js +++ /dev/null @@ -1,479 +0,0 @@ -/* - * 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; - -/** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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['DiagnosticSettingsCategoryResource']().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 diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 - * DiagnosticSettingsCategoryResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - 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['DiagnosticSettingsCategoryResourceCollection']().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 DiagnosticSettingsCategoryOperations. */ -class DiagnosticSettingsCategoryOperations { - /** - * Create a DiagnosticSettingsCategoryOperations. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._list = _list; - } - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceUri, name, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsCategoryResource} - 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 DiagnosticSettingsCategoryResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceUri, name, options, optionalCallback); - } - } - - /** - * Lists the diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, 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 diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsCategoryResourceCollection} - 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 - * DiagnosticSettingsCategoryResourceCollection} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = DiagnosticSettingsCategoryOperations; diff --git a/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js b/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js deleted file mode 100644 index be6f0864d9..0000000000 --- a/lib/services/monitor/lib/lib/operations/diagnosticSettingsOperations.js +++ /dev/null @@ -1,991 +0,0 @@ -/* - * 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; - -/** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 DiagnosticSettingsResource} 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(resourceUri, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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['DiagnosticSettingsResource']().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); - }); -} - -/** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri 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 (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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['DiagnosticSettingsResource']().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['DiagnosticSettingsResource']().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 existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); - 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); - }); -} - -/** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 DiagnosticSettingsResourceCollection} 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 _list(resourceUri, 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 = '2017-05-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/diagnosticSettings'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - 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['DiagnosticSettingsResourceCollection']().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 DiagnosticSettingsOperations. */ -class DiagnosticSettingsOperations { - /** - * Create a DiagnosticSettingsOperations. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._list = _list; - } - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceUri, name, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceUri, name, options, optionalCallback); - } - } - - /** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, parameters, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceUri, parameters, name, 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 diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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 DiagnosticSettingsResource} 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(resourceUri, parameters, name, 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(resourceUri, parameters, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(resourceUri, parameters, name, options, optionalCallback); - } - } - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(resourceUri, name, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri, name, 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(resourceUri, name, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(resourceUri, name, options, optionalCallback); - } - } - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsResourceCollection} - 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 DiagnosticSettingsResourceCollection} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = DiagnosticSettingsOperations; diff --git a/lib/services/monitor/lib/lib/operations/eventCategories.js b/lib/services/monitor/lib/lib/operations/eventCategories.js deleted file mode 100644 index b9705aa81a..0000000000 --- a/lib/services/monitor/lib/lib/operations/eventCategories.js +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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; - -/** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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 EventCategoryCollection} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/eventcategories'; - 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['EventCategoryCollection']().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 EventCategories. */ -class EventCategories { - /** - * Create a EventCategories. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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 {EventCategoryCollection} - 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 EventCategoryCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - -} - -module.exports = EventCategories; diff --git a/lib/services/monitor/lib/lib/operations/index.d.ts b/lib/services/monitor/lib/lib/operations/index.d.ts deleted file mode 100644 index f6c6bd1a66..0000000000 --- a/lib/services/monitor/lib/lib/operations/index.d.ts +++ /dev/null @@ -1,4284 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. -*/ - -import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; -import * as moment from 'moment'; -import * as models from '../models'; - - -/** - * @class - * AutoscaleSettings - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface AutoscaleSettings { - - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the autoscale settings for a resource group - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - - - /** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates an autoscale setting. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {array} parameters.profiles the collection of automatic scaling - * profiles that specify different scaling parameters for different time - * periods. A maximum of 20 profiles can be specified. - * - * @param {array} [parameters.notifications] the collection of notifications. - * - * @param {boolean} [parameters.enabled] the enabled flag. Specifies whether - * automatic scaling is enabled for the resource. The default value is 'true'. - * - * @param {string} [parameters.autoscaleSettingResourceName] the name of the - * autoscale setting. - * - * @param {string} [parameters.targetResourceUri] the resource identifier of - * the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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. - * - * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. - * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, autoscaleSettingName: string, parameters: models.AutoscaleSettingResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes and autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an autoscale setting - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @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 {AutoscaleSettingResource} - 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. - * - * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. - * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, autoscaleSettingName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, autoscaleSettingName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing AutoscaleSettingsResource. To update other fields use - * the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} autoscaleSettingName The autoscale setting name. - * - * @param {object} autoscaleSettingResource Parameters supplied to the - * operation. - * - * @param {object} [autoscaleSettingResource.tags] Resource tags - * - * @param {array} autoscaleSettingResource.profiles the collection of automatic - * scaling profiles that specify different scaling parameters for different - * time periods. A maximum of 20 profiles can be specified. - * - * @param {array} [autoscaleSettingResource.notifications] the collection of - * notifications. - * - * @param {boolean} [autoscaleSettingResource.enabled] the enabled flag. - * Specifies whether automatic scaling is enabled for the resource. The default - * value is 'true'. - * - * @param {string} [autoscaleSettingResource.name] the name of the autoscale - * setting. - * - * @param {string} [autoscaleSettingResource.targetResourceUri] the resource - * identifier of the resource that the autoscale setting should be added to. - * - * @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 {AutoscaleSettingResource} - 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. - * - * {AutoscaleSettingResource} [result] - The deserialized result object if an error did not occur. - * See {@link AutoscaleSettingResource} 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, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, callback: ServiceCallback): void; - update(resourceGroupName: string, autoscaleSettingName: string, autoscaleSettingResource: models.AutoscaleSettingResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists the autoscale settings for a resource group - * - * @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. - */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the autoscale settings for a resource group - * - * @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. - */ - 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; -} - -/** - * @class - * Operations - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface Operations { - - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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 {OperationListResult} - 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. - * - * {OperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link OperationListResult} 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. - */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * AlertRuleIncidents - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface AlertRuleIncidents { - - - /** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an incident associated to an alert rule - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} incidentName The name of the incident to retrieve. - * - * @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 {Incident} - 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. - * - * {Incident} [result] - The deserialized result object if an error did not occur. - * See {@link Incident} 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, incidentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, ruleName: string, incidentName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, ruleName: string, incidentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets a list of incidents associated to an alert 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. - */ - listByAlertRuleWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a list of incidents associated to an alert 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 {IncidentListResult} - 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. - * - * {IncidentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link IncidentListResult} 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. - */ - listByAlertRule(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAlertRule(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; - listByAlertRule(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * AlertRules - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface AlertRules { - - - /** - * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates an alert 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.alertRuleResourceName the name of the alert rule. - * - * @param {string} [parameters.description] the description of the alert rule - * that will be included in the alert email. - * - * @param {boolean} parameters.isEnabled the flag that indicates whether the - * alert rule is enabled. - * - * @param {object} parameters.condition the condition that results in the alert - * rule being activated. - * - * @param {object} [parameters.condition.dataSource] the resource from which - * the rule collects its data. For this type dataSource will always be of type - * RuleMetricDataSource. - * - * @param {string} [parameters.condition.dataSource.resourceUri] the resource - * identifier of the resource the rule monitors. **NOTE**: this property cannot - * be updated for an existing rule. - * - * @param {string} parameters.condition.dataSource.odatatype Polymorphic - * Discriminator - * - * @param {string} parameters.condition.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {AlertRuleResource} - 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. - * - * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. - * See {@link AlertRuleResource} 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.AlertRuleResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.AlertRuleResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes an alert 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 an alert 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; - - - /** - * Gets an alert 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 alert 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 {AlertRuleResource} - 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. - * - * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. - * See {@link AlertRuleResource} 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; - - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing AlertRuleResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {object} alertRulesResource Parameters supplied to the operation. - * - * @param {object} [alertRulesResource.tags] Resource tags - * - * @param {string} alertRulesResource.name the name of the alert rule. - * - * @param {string} [alertRulesResource.description] the description of the - * alert rule that will be included in the alert email. - * - * @param {boolean} alertRulesResource.isEnabled the flag that indicates - * whether the alert rule is enabled. - * - * @param {object} alertRulesResource.condition the condition that results in - * the alert rule being activated. - * - * @param {object} [alertRulesResource.condition.dataSource] the resource from - * which the rule collects its data. For this type dataSource will always be of - * type RuleMetricDataSource. - * - * @param {string} [alertRulesResource.condition.dataSource.resourceUri] the - * resource identifier of the resource the rule monitors. **NOTE**: this - * property cannot be updated for an existing rule. - * - * @param {string} alertRulesResource.condition.dataSource.odatatype - * Polymorphic Discriminator - * - * @param {string} alertRulesResource.condition.odatatype Polymorphic - * Discriminator - * - * @param {array} [alertRulesResource.actions] the array of actions that are - * performed when the alert rule becomes active, and when an alert condition is - * resolved. - * - * @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 {AlertRuleResource} - 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. - * - * {AlertRuleResource} [result] - The deserialized result object if an error did not occur. - * See {@link AlertRuleResource} 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, alertRulesResource: models.AlertRuleResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, callback: ServiceCallback): void; - update(resourceGroupName: string, ruleName: string, alertRulesResource: models.AlertRuleResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * List the alert rules within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; -} - -/** - * @class - * LogProfiles - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface LogProfiles { - - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(logProfileName: string, callback: ServiceCallback): void; - deleteMethod(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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 {LogProfileResource} - 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. - * - * {LogProfileResource} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileResource} 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(logProfileName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(logProfileName: string, callback: ServiceCallback): void; - get(logProfileName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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. - * - * {LogProfileResource} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileResource} 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(logProfileName: string, parameters: models.LogProfileResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, callback: ServiceCallback): void; - createOrUpdate(logProfileName: string, parameters: models.LogProfileResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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. - * - * {LogProfileResource} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileResource} 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(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, callback: ServiceCallback): void; - update(logProfileName: string, logProfilesResource: models.LogProfileResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * List the log profiles. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * List the log profiles. - * - * @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 {LogProfileCollection} - 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. - * - * {LogProfileCollection} [result] - The deserialized result object if an error did not occur. - * See {@link LogProfileCollection} 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. - */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DiagnosticSettingsOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface DiagnosticSettingsOperations { - - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the active diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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. - * - * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceUri: string, name: string, callback: ServiceCallback): void; - get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates or updates diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] The resource ID of the storage - * account to which you would like to send Diagnostic Logs. - * - * @param {string} [parameters.eventHubAuthorizationRuleId] The resource Id for - * the event hub authorization rule. - * - * @param {string} [parameters.eventHubName] The name of the event hub. If none - * is specified, the default event hub will be selected. - * - * @param {array} [parameters.metrics] the list of metric settings. - * - * @param {array} [parameters.logs] the list of logs settings. - * - * @param {string} [parameters.workspaceId] The workspace ID (resource ID of a - * Log Analytics workspace) for a Log Analytics workspace to which you would - * like to send Diagnostic Logs. Example: - * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsResource} - 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. - * - * {DiagnosticSettingsResource} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsResource} 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(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, callback: ServiceCallback): void; - createOrUpdate(resourceUri: string, parameters: models.DiagnosticSettingsResource, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes existing diagnostic settings for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceUri: string, name: string, callback: ServiceCallback): void; - deleteMethod(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the active diagnostic settings list for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsResourceCollection} - 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. - * - * {DiagnosticSettingsResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsResourceCollection} 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. - */ - list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DiagnosticSettingsCategoryOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface DiagnosticSettingsCategoryOperations { - - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the diagnostic settings category for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {string} name The name of the diagnostic setting. - * - * @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 {DiagnosticSettingsCategoryResource} - 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. - * - * {DiagnosticSettingsCategoryResource} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticSettingsCategoryResource} 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(resourceUri: string, name: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceUri: string, name: string, callback: ServiceCallback): void; - get(resourceUri: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists the diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the diagnostic settings categories for the specified resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @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 {DiagnosticSettingsCategoryResourceCollection} - 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. - * - * {DiagnosticSettingsCategoryResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link - * DiagnosticSettingsCategoryResourceCollection} 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. - */ - list(resourceUri: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActionGroups - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface ActionGroups { - - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create a new action group or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroup The action group to create or use for the - * update. - * - * @param {string} actionGroup.groupShortName The short name of the action - * group. This will be used in SMS messages. - * - * @param {boolean} actionGroup.enabled Indicates whether this action group is - * enabled. If an action group is not enabled, then none of its receivers will - * receive communications. - * - * @param {array} [actionGroup.emailReceivers] The list of email receivers that - * are part of this action group. - * - * @param {array} [actionGroup.smsReceivers] The list of SMS receivers that are - * part of this action group. - * - * @param {array} [actionGroup.webhookReceivers] The list of webhook receivers - * that are part of this action group. - * - * @param {array} [actionGroup.itsmReceivers] The list of ITSM receivers that - * are part of this action group. - * - * @param {array} [actionGroup.azureAppPushReceivers] The list of AzureAppPush - * receivers that are part of this action group. - * - * @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 - * - * @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 {ActionGroupResource} - 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. - * - * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroup: models.ActionGroupResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, actionGroupName: string, actionGroup: models.ActionGroupResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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 {ActionGroupResource} - 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. - * - * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupResource} 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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Delete an action group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @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, actionGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, actionGroupName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, actionGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing action group's tags. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {object} actionGroupPatch Parameters supplied to the operation. - * - * @param {object} [actionGroupPatch.tags] Resource tags - * - * @param {boolean} [actionGroupPatch.enabled] Indicates whether this action - * group is enabled. If an action group is not enabled, then none of its - * actions will be activated. - * - * @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 {ActionGroupResource} - 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. - * - * {ActionGroupResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupResource} 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, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, callback: ServiceCallback): void; - update(resourceGroupName: string, actionGroupName: string, actionGroupPatch: models.ActionGroupPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all action groups in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all action groups in 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 {ActionGroupList} - 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. - * - * {ActionGroupList} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupList} 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. - */ - listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySubscriptionId(callback: ServiceCallback): void; - listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all action groups in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActionGroupList} - 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. - * - * {ActionGroupList} [result] - The deserialized result object if an error did not occur. - * See {@link ActionGroupList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiverWithHttpOperationResponse(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Enable a receiver in an action group. This changes the receiver's status - * from Disabled to Enabled. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} actionGroupName The name of the action group. - * - * @param {string} receiverName The name of the receiver to resubscribe. - * - * @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. - */ - enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, callback: ServiceCallback): void; - enableReceiver(resourceGroupName: string, actionGroupName: string, receiverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActivityLogAlerts - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface ActivityLogAlerts { - - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create a new activity log alert or update an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlert The activity log alert to create or use for - * the update. - * - * @param {array} activityLogAlert.scopes A list of resourceIds that will be - * used as prefixes. The alert will only apply to activityLogs with resourceIds - * that fall under one of these prefixes. This list must include at least one - * item. - * - * @param {boolean} [activityLogAlert.enabled] Indicates whether this activity - * log alert is enabled. If an activity log alert is not enabled, then none of - * its actions will be activated. - * - * @param {object} activityLogAlert.condition The condition that will cause - * this alert to activate. - * - * @param {array} activityLogAlert.condition.allOf The list of activity log - * alert conditions. - * - * @param {object} activityLogAlert.actions The actions that will activate when - * the condition is met. - * - * @param {array} [activityLogAlert.actions.actionGroups] The list of activity - * log alerts. - * - * @param {string} [activityLogAlert.description] A description of this - * activity log alert. - * - * @param {string} activityLogAlert.location Resource location - * - * @param {object} [activityLogAlert.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 {ActivityLogAlertResource} - 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. - * - * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, activityLogAlertName: string, activityLogAlert: models.ActivityLogAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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 {ActivityLogAlertResource} - 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. - * - * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Delete an activity log alert. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @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, activityLogAlertName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, activityLogAlertName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, activityLogAlertName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates an existing ActivityLogAlertResource's tags. To update other fields - * use the CreateOrUpdate method. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} activityLogAlertName The name of the activity log alert. - * - * @param {object} activityLogAlertPatch Parameters supplied to the operation. - * - * @param {object} [activityLogAlertPatch.tags] Resource tags - * - * @param {boolean} [activityLogAlertPatch.enabled] Indicates whether this - * activity log alert is enabled. If an activity log alert is not enabled, then - * none of its actions will be activated. - * - * @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 {ActivityLogAlertResource} - 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. - * - * {ActivityLogAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertResource} 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, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, callback: ServiceCallback): void; - update(resourceGroupName: string, activityLogAlertName: string, activityLogAlertPatch: models.ActivityLogAlertPatchBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all activity log alerts in 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. - */ - listBySubscriptionIdWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all activity log alerts in 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 {ActivityLogAlertList} - 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. - * - * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertList} 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. - */ - listBySubscriptionId(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySubscriptionId(callback: ServiceCallback): void; - listBySubscriptionId(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a list of all activity log alerts in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ActivityLogAlertList} - 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. - * - * {ActivityLogAlertList} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityLogAlertList} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActivityLogs - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface ActivityLogs { - - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Provides the list of records from the activity logs. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** argument is very restricted and allows only the following - * patterns.
- *List events for a resource group*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq - * 'resourceGroupName'.
- *List events for resource*: $filter=eventTimestamp - * ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List - * events for a subscription in a time range*: $filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq - * 'resourceProviderName'.
- *List events for a correlation Id*: - * $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp - * le '2014-07-20T04:36:37.6407898Z' and correlationId eq - * 'correlationID'.

**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Provides the list of records from the activity logs. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Provides the list of records from the activity logs. - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * EventCategories - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface EventCategories { - - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get the list of available event categories supported in the Activity Logs - * Service.
The current list includes the following: Administrative, - * Security, ServiceHealth, Alert, Recommendation, Policy. - * - * @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 {EventCategoryCollection} - 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. - * - * {EventCategoryCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventCategoryCollection} 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. - */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * TenantActivityLogs - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface TenantActivityLogs { - - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - list(options?: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { filter? : string, select? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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 {EventDataCollection} - 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. - * - * {EventDataCollection} [result] - The deserialized result object if an error did not occur. - * See {@link EventDataCollection} 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. - */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * MetricDefinitions - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricDefinitions { - - - /** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {MetricDefinitionCollection} - 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. - * - * {MetricDefinitionCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricDefinitionCollection} 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. - */ - list(resourceUri: string, options?: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Metrics - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface Metrics { - - - /** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {Response} - 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. - * - * {Response} [result] - The deserialized result object if an error did not occur. - * See {@link Response} 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. - */ - list(resourceUri: string, options?: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceUri: string, callback: ServiceCallback): void; - list(resourceUri: string, options: { timespan? : string, interval? : moment.Duration, metricnames? : string, aggregation? : string, top? : number, orderby? : string, filter? : string, resultType? : string, metricnamespace? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * MetricBaseline - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricBaseline { - - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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 {BaselineResponse} - 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. - * - * {BaselineResponse} [result] - The deserialized result object if an error did not occur. - * See {@link BaselineResponse} 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(resourceUri: string, metricName: string, options?: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceUri: string, metricName: string, callback: ServiceCallback): void; - get(resourceUri: string, metricName: string, options: { timespan? : string, interval? : moment.Duration, aggregation? : string, sensitivities? : string, resultType? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * **Lists the baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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. - */ - calculateBaselineWithHttpOperationResponse(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * **Lists the baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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 {CalculateBaselineResponse} - 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. - * - * {CalculateBaselineResponse} [result] - The deserialized result object if an error did not occur. - * See {@link CalculateBaselineResponse} 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. - */ - calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, callback: ServiceCallback): void; - calculateBaseline(resourceUri: string, timeSeriesInformation: models.TimeSeriesInformation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * MetricAlerts - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricAlerts { - - - /** - * Retrieve alert rule definitions in 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>; - - /** - * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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. - * - * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResourceCollection} 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; - - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {MetricAlertResourceCollection} - 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. - * - * {MetricAlertResourceCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResourceCollection} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Retrieve an alert rule definiton. - * - * @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>; - - /** - * Retrieve an alert rule definiton. - * - * @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 {MetricAlertResource} - 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. - * - * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResource} 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; - - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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. - * - * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResource} 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.MetricAlertResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Update an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Update an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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. - * - * {MetricAlertResource} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertResource} 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.MetricAlertResourcePatch, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, callback: ServiceCallback): void; - update(resourceGroupName: string, ruleName: string, parameters: models.MetricAlertResourcePatch, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Delete an alert rule defitiniton. - * - * @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>; - - /** - * Delete an alert rule defitiniton. - * - * @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; -} - -/** - * @class - * MetricAlertsStatus - * __NOTE__: An instance of this class is automatically created for an - * instance of the MonitorManagementClient. - */ -export interface MetricAlertsStatus { - - - /** - * Retrieve an alert rule status. - * - * @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. - */ - listWithHttpOperationResponse(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve an alert rule status. - * - * @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 {MetricAlertStatusCollection} - 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. - * - * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertStatusCollection} 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. - */ - list(resourceGroupName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, ruleName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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. - */ - listByNameWithHttpOperationResponse(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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 {MetricAlertStatusCollection} - 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. - * - * {MetricAlertStatusCollection} [result] - The deserialized result object if an error did not occur. - * See {@link MetricAlertStatusCollection} 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. - */ - listByName(resourceGroupName: string, ruleName: string, statusName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - 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; -} diff --git a/lib/services/monitor/lib/lib/operations/index.js b/lib/services/monitor/lib/lib/operations/index.js deleted file mode 100644 index 56d8f5aa1b..0000000000 --- a/lib/services/monitor/lib/lib/operations/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -exports.AutoscaleSettings = require('./autoscaleSettings'); -exports.Operations = require('./operations'); -exports.AlertRuleIncidents = require('./alertRuleIncidents'); -exports.AlertRules = require('./alertRules'); -exports.LogProfiles = require('./logProfiles'); -exports.DiagnosticSettingsOperations = require('./diagnosticSettingsOperations'); -exports.DiagnosticSettingsCategoryOperations = require('./diagnosticSettingsCategoryOperations'); -exports.ActionGroups = require('./actionGroups'); -exports.ActivityLogAlerts = require('./activityLogAlerts'); -exports.ActivityLogs = require('./activityLogs'); -exports.EventCategories = require('./eventCategories'); -exports.TenantActivityLogs = require('./tenantActivityLogs'); -exports.MetricDefinitions = require('./metricDefinitions'); -exports.Metrics = require('./metrics'); -exports.MetricBaseline = require('./metricBaseline'); -exports.MetricAlerts = require('./metricAlerts'); -exports.MetricAlertsStatus = require('./metricAlertsStatus'); diff --git a/lib/services/monitor/lib/lib/operations/logProfiles.js b/lib/services/monitor/lib/lib/operations/logProfiles.js deleted file mode 100644 index 8c61a074e5..0000000000 --- a/lib/services/monitor/lib/lib/operations/logProfiles.js +++ /dev/null @@ -1,1319 +0,0 @@ -/* - * 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; - -/** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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) { - 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; - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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 LogProfileResource} 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(logProfileName, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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['LogProfileResource']().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); - }); -} - -/** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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 LogProfileResource} 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(logProfileName, 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 = '2016-03-01'; - // Validate - try { - if (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName 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.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/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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 = '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['LogProfileResource']().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) { - 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['LogProfileResource']().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); - }); -} - -/** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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 LogProfileResource} 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(logProfileName, logProfilesResource, 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 (logProfileName === null || logProfileName === undefined || typeof logProfileName.valueOf() !== 'string') { - throw new Error('logProfileName cannot be null or undefined and it must be of type string.'); - } - if (logProfilesResource === null || logProfilesResource === undefined) { - throw new Error('logProfilesResource 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}/providers/microsoft.insights/logprofiles/{logProfileName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{logProfileName}', encodeURIComponent(logProfileName)); - 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 (logProfilesResource !== null && logProfilesResource !== undefined) { - let requestModelMapper = new client.models['LogProfileResourcePatch']().mapper(); - requestModel = client.serialize(requestModelMapper, logProfilesResource, 'logProfilesResource'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(logProfilesResource, 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['LogProfileResource']().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 profiles. - * - * @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 LogProfileCollection} 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 _list(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/logprofiles'; - 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['LogProfileCollection']().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 LogProfiles. */ -class LogProfiles { - /** - * Create a LogProfiles. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._update = _update; - this._list = _list; - } - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._deleteMethod(logProfileName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Deletes the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._deleteMethod(logProfileName, options, optionalCallback); - } - } - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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(logProfileName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(logProfileName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the log profile. - * - * @param {string} logProfileName The name of the log profile. - * - * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(logProfileName, options, optionalCallback); - } - } - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(logProfileName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Create or update a log profile in Azure Monitoring REST API. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} parameters Parameters supplied to the operation. - * - * @param {string} [parameters.storageAccountId] the resource id of the storage - * account to which you would like to send the Activity Log. - * - * @param {string} [parameters.serviceBusRuleId] The service bus rule ID of the - * service bus namespace in which you would like to have Event Hubs created for - * streaming the Activity Log. The rule ID is of the format: '{service bus - * resource ID}/authorizationrules/{key name}'. - * - * @param {array} parameters.locations List of regions for which Activity Log - * events should be stored or streamed. It is a comma separated list of valid - * ARM locations including the 'global' location. - * - * @param {array} parameters.categories the categories of the logs. These - * categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} parameters.retentionPolicy the retention policy for the - * events in the log. - * - * @param {boolean} parameters.retentionPolicy.enabled a value indicating - * whether the retention policy is enabled. - * - * @param {number} parameters.retentionPolicy.days the number of days for the - * retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, 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(logProfileName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._createOrUpdate(logProfileName, parameters, options, optionalCallback); - } - } - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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(logProfileName, logProfilesResource, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._update(logProfileName, logProfilesResource, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Updates an existing LogProfilesResource. To update other fields use the - * CreateOrUpdate method. - * - * @param {string} logProfileName The name of the log profile. - * - * @param {object} logProfilesResource Parameters supplied to the operation. - * - * @param {object} [logProfilesResource.tags] Resource tags - * - * @param {string} [logProfilesResource.storageAccountId] the resource id of - * the storage account to which you would like to send the Activity Log. - * - * @param {string} [logProfilesResource.serviceBusRuleId] The service bus rule - * ID of the service bus namespace in which you would like to have Event Hubs - * created for streaming the Activity Log. The rule ID is of the format: - * '{service bus resource ID}/authorizationrules/{key name}'. - * - * @param {array} logProfilesResource.locations List of regions for which - * Activity Log events should be stored or streamed. It is a comma separated - * list of valid ARM locations including the 'global' location. - * - * @param {array} logProfilesResource.categories the categories of the logs. - * These categories are created as is convenient to the user. Some values are: - * 'Write', 'Delete', and/or 'Action.' - * - * @param {object} logProfilesResource.retentionPolicy the retention policy for - * the events in the log. - * - * @param {boolean} logProfilesResource.retentionPolicy.enabled a value - * indicating whether the retention policy is enabled. - * - * @param {number} logProfilesResource.retentionPolicy.days the number of days - * for the retention in days. A value of 0 will retain the events indefinitely. - * - * @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 {LogProfileResource} - 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 LogProfileResource} 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(logProfileName, logProfilesResource, 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(logProfileName, logProfilesResource, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._update(logProfileName, logProfilesResource, options, optionalCallback); - } - } - - /** - * List the log profiles. - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(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 profiles. - * - * @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 {LogProfileCollection} - 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 LogProfileCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - -} - -module.exports = LogProfiles; diff --git a/lib/services/monitor/lib/lib/operations/metricAlerts.js b/lib/services/monitor/lib/lib/operations/metricAlerts.js deleted file mode 100644 index a08ce456ba..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricAlerts.js +++ /dev/null @@ -1,1590 +0,0 @@ -/* - * 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; -const moment = require('moment'); - -/** - * Retrieve alert rule definitions in 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 MetricAlertResourceCollection} 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 = '2018-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/metricAlerts'; - 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['MetricAlertResourceCollection']().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); - }); -} - -/** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 MetricAlertResourceCollection} 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 apiVersion = '2018-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 (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 (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/metricAlerts'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - 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['MetricAlertResourceCollection']().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); - }); -} - -/** - * Retrieve an alert rule definiton. - * - * @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 MetricAlertResource} 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-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 (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.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/metricAlerts/{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 = '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['MetricAlertResource']().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); - }); -} - -/** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 MetricAlertResource} 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-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 (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/metricAlerts/{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['MetricAlertResource']().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['MetricAlertResource']().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 an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 MetricAlertResource} 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-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 (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/metricAlerts/{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['MetricAlertResourcePatch']().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['MetricAlertResource']().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); - }); -} - -/** - * Delete an alert rule defitiniton. - * - * @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-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 (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.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/metricAlerts/{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 = '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) { - 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; - - return callback(null, result, httpRequest, response); - }); -} - -/** Class representing a MetricAlerts. */ -class MetricAlerts { - /** - * Create a MetricAlerts. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._listBySubscription = _listBySubscription; - this._listByResourceGroup = _listByResourceGroup; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._update = _update; - this._deleteMethod = _deleteMethod; - } - - /** - * Retrieve alert rule definitions in 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; - }); - }); - } - - /** - * Retrieve alert rule definitions in 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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); - } - } - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - 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; - }); - }); - } - - /** - * Retrieve alert rule defintions in a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {MetricAlertResourceCollection} - 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 MetricAlertResourceCollection} 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); - } - } - - /** - * Retrieve an alert rule definiton. - * - * @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; - }); - }); - } - - /** - * Retrieve an alert rule definiton. - * - * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); - } - } - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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; - }); - }); - } - - /** - * Create or update an metric alert definition. - * - * @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 metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); - } - } - - /** - * Update an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 an metric alert definition. - * - * @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.description the description of the metric alert - * that will be included in the alert email. - * - * @param {number} parameters.severity Alert severity {0, 1, 2, 3, 4} - * - * @param {boolean} parameters.enabled the flag that indicates whether the - * metric alert is enabled. - * - * @param {array} [parameters.scopes] the list of resource id's that this - * metric alert is scoped to. - * - * @param {moment.duration} parameters.evaluationFrequency how often the metric - * alert is evaluated represented in ISO 8601 duration format. - * - * @param {moment.duration} parameters.windowSize the period of time (in ISO - * 8601 duration format) that is used to monitor alert activity based on the - * threshold. - * - * @param {object} parameters.criteria defines the specific alert criteria - * information. - * - * @param {string} parameters.criteria.odatatype Polymorphic Discriminator - * - * @param {array} [parameters.actions] the array of actions that are performed - * when the alert rule becomes active, and when an alert condition is resolved. - * - * @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 {MetricAlertResource} - 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 MetricAlertResource} 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); - } - } - - /** - * Delete an alert rule defitiniton. - * - * @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; - }); - }); - } - - /** - * Delete an alert rule defitiniton. - * - * @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); - } - } - -} - -module.exports = MetricAlerts; diff --git a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js b/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js deleted file mode 100644 index 29b4afc056..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricAlertsStatus.js +++ /dev/null @@ -1,505 +0,0 @@ -/* - * 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; - -/** - * Retrieve an alert rule status. - * - * @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 MetricAlertStatusCollection} 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 _list(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-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 (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.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/metricAlerts/{ruleName}/status'; - 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 = '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['MetricAlertStatusCollection']().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); - }); -} - -/** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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 MetricAlertStatusCollection} 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 _listByName(resourceGroupName, ruleName, statusName, 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-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 (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 (statusName === null || statusName === undefined || typeof statusName.valueOf() !== 'string') { - throw new Error('statusName 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/metricAlerts/{ruleName}/status/{statusName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); - requestUrl = requestUrl.replace('{statusName}', encodeURIComponent(statusName)); - 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['MetricAlertStatusCollection']().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 MetricAlertsStatus. */ -class MetricAlertsStatus { - /** - * Create a MetricAlertsStatus. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listByName = _listByName; - } - - /** - * Retrieve an alert rule status. - * - * @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. - */ - listWithHttpOperationResponse(resourceGroupName, ruleName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(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; - }); - }); - } - - /** - * Retrieve an alert rule status. - * - * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. - */ - list(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._list(resourceGroupName, ruleName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceGroupName, ruleName, options, optionalCallback); - } - } - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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. - */ - listByNameWithHttpOperationResponse(resourceGroupName, ruleName, statusName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Retrieve an alert rule status. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} ruleName The name of the rule. - * - * @param {string} statusName The name of the status. - * - * @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 {MetricAlertStatusCollection} - 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 MetricAlertStatusCollection} 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. - */ - listByName(resourceGroupName, ruleName, statusName, 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._listByName(resourceGroupName, ruleName, statusName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByName(resourceGroupName, ruleName, statusName, options, optionalCallback); - } - } - -} - -module.exports = MetricAlertsStatus; diff --git a/lib/services/monitor/lib/lib/operations/metricBaseline.js b/lib/services/monitor/lib/lib/operations/metricBaseline.js deleted file mode 100644 index 365ca4990c..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricBaseline.js +++ /dev/null @@ -1,642 +0,0 @@ -/* - * 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; -const moment = require('moment'); - -/** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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 BaselineResponse} 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(resourceUri, metricName, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; - let interval = (options && options.interval !== undefined) ? options.interval : undefined; - let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; - let sensitivities = (options && options.sensitivities !== undefined) ? options.sensitivities : undefined; - let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; - let apiVersion = '2017-11-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (metricName === null || metricName === undefined || typeof metricName.valueOf() !== 'string') { - throw new Error('metricName cannot be null or undefined and it must be of type string.'); - } - if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { - throw new Error('timespan must be of type string.'); - } - if(interval && !moment.isDuration(interval)) { - throw new Error('interval must be of type moment.duration.'); - } - if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { - throw new Error('aggregation must be of type string.'); - } - if (sensitivities !== null && sensitivities !== undefined && typeof sensitivities.valueOf() !== 'string') { - throw new Error('sensitivities must be of type string.'); - } - if (resultType) { - let allowedValues = [ 'Data', 'Metadata' ]; - if (!allowedValues.some( function(item) { return item === resultType; })) { - throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); - } - } - 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/baseline/{metricName}'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - requestUrl = requestUrl.replace('{metricName}', encodeURIComponent(metricName)); - let queryParameters = []; - if (timespan !== null && timespan !== undefined) { - queryParameters.push('timespan=' + encodeURIComponent(timespan)); - } - if (interval !== null && interval !== undefined) { - queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); - } - if (aggregation !== null && aggregation !== undefined) { - queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); - } - if (sensitivities !== null && sensitivities !== undefined) { - queryParameters.push('sensitivities=' + encodeURIComponent(sensitivities)); - } - if (resultType !== null && resultType !== undefined) { - queryParameters.push('resultType=' + encodeURIComponent(resultType)); - } - 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['BaselineResponse']().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 baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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 CalculateBaselineResponse} 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 _calculateBaseline(resourceUri, timeSeriesInformation, 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 = '2017-11-01-preview'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (timeSeriesInformation === null || timeSeriesInformation === undefined) { - throw new Error('timeSeriesInformation 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/calculatebaseline'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - 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 = 'POST'; - 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 (timeSeriesInformation !== null && timeSeriesInformation !== undefined) { - let requestModelMapper = new client.models['TimeSeriesInformation']().mapper(); - requestModel = client.serialize(requestModelMapper, timeSeriesInformation, 'timeSeriesInformation'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(timeSeriesInformation, 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['CalculateBaselineResponse']().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 MetricBaseline. */ -class MetricBaseline { - /** - * Create a MetricBaseline. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._calculateBaseline = _calculateBaseline; - } - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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(resourceUri, metricName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceUri, metricName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * **Gets the baseline values for a specific metric**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {string} metricName The name of the metric to retrieve the baseline - * for. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.aggregation] The aggregation type of the metric to - * retrieve the baseline for. - * - * @param {string} [options.sensitivities] The list of sensitivities (comma - * separated) to retrieve. - * - * @param {string} [options.resultType] Allows retrieving only metadata of the - * baseline. On data request all information is retrieved. Possible values - * include: 'Data', 'Metadata' - * - * @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 {BaselineResponse} - 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 BaselineResponse} 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(resourceUri, metricName, 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(resourceUri, metricName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._get(resourceUri, metricName, options, optionalCallback); - } - } - - /** - * **Lists the baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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. - */ - calculateBaselineWithHttpOperationResponse(resourceUri, timeSeriesInformation, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._calculateBaseline(resourceUri, timeSeriesInformation, 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 baseline values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. It has the - * following structure: - * subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - * For example: - * subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - * - * @param {object} timeSeriesInformation Information that need to be specified - * to calculate a baseline on a time series. - * - * @param {array} timeSeriesInformation.sensitivities the list of sensitivities - * for calculating the baseline. - * - * @param {array} timeSeriesInformation.values The metric values to calculate - * the baseline. - * - * @param {array} [timeSeriesInformation.timestamps] the array of timestamps of - * the baselines. - * - * @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 {CalculateBaselineResponse} - 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 CalculateBaselineResponse} 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. - */ - calculateBaseline(resourceUri, timeSeriesInformation, 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._calculateBaseline(resourceUri, timeSeriesInformation, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._calculateBaseline(resourceUri, timeSeriesInformation, options, optionalCallback); - } - } - -} - -module.exports = MetricBaseline; diff --git a/lib/services/monitor/lib/lib/operations/metricDefinitions.js b/lib/services/monitor/lib/lib/operations/metricDefinitions.js deleted file mode 100644 index f3d1817183..0000000000 --- a/lib/services/monitor/lib/lib/operations/metricDefinitions.js +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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; - -/** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 MetricDefinitionCollection} 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 _list(resourceUri, 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 metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; - let apiVersion = '2018-01-01'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { - throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metricDefinitions'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (metricnamespace !== null && metricnamespace !== undefined) { - queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); - } - 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['MetricDefinitionCollection']().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 MetricDefinitions. */ -class MetricDefinitions { - /** - * Create a MetricDefinitions. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * Lists the metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, 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 metric definitions for the resource. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {MetricDefinitionCollection} - 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 MetricDefinitionCollection} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = MetricDefinitions; diff --git a/lib/services/monitor/lib/lib/operations/metrics.js b/lib/services/monitor/lib/lib/operations/metrics.js deleted file mode 100644 index 02d0aa5489..0000000000 --- a/lib/services/monitor/lib/lib/operations/metrics.js +++ /dev/null @@ -1,430 +0,0 @@ -/* - * 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; -const moment = require('moment'); - -/** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 Response} 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 _list(resourceUri, 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 timespan = (options && options.timespan !== undefined) ? options.timespan : undefined; - let interval = (options && options.interval !== undefined) ? options.interval : undefined; - let metricnames = (options && options.metricnames !== undefined) ? options.metricnames : undefined; - let aggregation = (options && options.aggregation !== undefined) ? options.aggregation : undefined; - let top = (options && options.top !== undefined) ? options.top : undefined; - let orderby = (options && options.orderby !== undefined) ? options.orderby : undefined; - let filter = (options && options.filter !== undefined) ? options.filter : undefined; - let resultType = (options && options.resultType !== undefined) ? options.resultType : undefined; - let metricnamespace = (options && options.metricnamespace !== undefined) ? options.metricnamespace : undefined; - let apiVersion = '2018-01-01'; - // Validate - try { - if (resourceUri === null || resourceUri === undefined || typeof resourceUri.valueOf() !== 'string') { - throw new Error('resourceUri cannot be null or undefined and it must be of type string.'); - } - if (timespan !== null && timespan !== undefined && typeof timespan.valueOf() !== 'string') { - throw new Error('timespan must be of type string.'); - } - if(interval && !moment.isDuration(interval)) { - throw new Error('interval must be of type moment.duration.'); - } - if (metricnames !== null && metricnames !== undefined && typeof metricnames.valueOf() !== 'string') { - throw new Error('metricnames must be of type string.'); - } - if (aggregation !== null && aggregation !== undefined && typeof aggregation.valueOf() !== 'string') { - throw new Error('aggregation must be of type string.'); - } - if (top !== null && top !== undefined && typeof top !== 'number') { - throw new Error('top must be of type number.'); - } - if (orderby !== null && orderby !== undefined && typeof orderby.valueOf() !== 'string') { - throw new Error('orderby must be of type string.'); - } - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); - } - if (resultType) { - let allowedValues = [ 'Data', 'Metadata' ]; - if (!allowedValues.some( function(item) { return item === resultType; })) { - throw new Error(resultType + ' is not a valid value. The valid values are: ' + allowedValues); - } - } - if (metricnamespace !== null && metricnamespace !== undefined && typeof metricnamespace.valueOf() !== 'string') { - throw new Error('metricnamespace 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('/') ? '' : '/') + '{resourceUri}/providers/microsoft.insights/metrics'; - requestUrl = requestUrl.replace('{resourceUri}', resourceUri); - let queryParameters = []; - if (timespan !== null && timespan !== undefined) { - queryParameters.push('timespan=' + encodeURIComponent(timespan)); - } - if (interval !== null && interval !== undefined) { - queryParameters.push('interval=' + encodeURIComponent(interval.toISOString())); - } - if (metricnames !== null && metricnames !== undefined) { - queryParameters.push('metricnames=' + encodeURIComponent(metricnames)); - } - if (aggregation !== null && aggregation !== undefined) { - queryParameters.push('aggregation=' + encodeURIComponent(aggregation)); - } - if (top !== null && top !== undefined) { - queryParameters.push('top=' + encodeURIComponent(top.toString())); - } - if (orderby !== null && orderby !== undefined) { - queryParameters.push('orderby=' + encodeURIComponent(orderby)); - } - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } - if (resultType !== null && resultType !== undefined) { - queryParameters.push('resultType=' + encodeURIComponent(resultType)); - } - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (metricnamespace !== null && metricnamespace !== undefined) { - queryParameters.push('metricnamespace=' + encodeURIComponent(metricnamespace)); - } - 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['Response']().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 Metrics. */ -class Metrics { - /** - * Create a Metrics. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * **Lists the metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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. - */ - listWithHttpOperationResponse(resourceUri, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(resourceUri, 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 metric values for a resource**. - * - * @param {string} resourceUri The identifier of the resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.timespan] The timespan of the query. It is a string - * with the following format 'startDateTime_ISO/endDateTime_ISO'. - * - * @param {moment.duration} [options.interval] The interval (i.e. timegrain) of - * the query. - * - * @param {string} [options.metricnames] The names of the metrics (comma - * separated) to retrieve. - * - * @param {string} [options.aggregation] The list of aggregation types (comma - * separated) to retrieve. - * - * @param {number} [options.top] The maximum number of records to retrieve. - * Valid only if $filter is specified. - * Defaults to 10. - * - * @param {string} [options.orderby] The aggregation to use for sorting results - * and the direction of the sort. - * Only one order can be specified. - * Examples: sum asc. - * - * @param {string} [options.filter] The **$filter** is used to reduce the set - * of metric data returned.
Example:
Metric contains metadata A, B and - * C.
- Return all time series of C where A = a1 and B = b1 or - * b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- - * Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = - * ‘b2’**
This is invalid because the logical or operator cannot separate - * two different metadata names.
- Return all time series where A = a1, B = - * b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- - * Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and - * C eq ‘*’**. - * - * @param {string} [options.resultType] Reduces the set of data collected. The - * syntax allowed depends on the operation. See the operation's description for - * details. Possible values include: 'Data', 'Metadata' - * - * @param {string} [options.metricnamespace] Metric namespace to query metric - * definitions for. - * - * @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 {Response} - 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 Response} 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. - */ - list(resourceUri, 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._list(resourceUri, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(resourceUri, options, optionalCallback); - } - } - -} - -module.exports = Metrics; diff --git a/lib/services/monitor/lib/lib/operations/operations.js b/lib/services/monitor/lib/lib/operations/operations.js deleted file mode 100644 index 664c03afa7..0000000000 --- a/lib/services/monitor/lib/lib/operations/operations.js +++ /dev/null @@ -1,235 +0,0 @@ -/* - * 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; - -/** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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 OperationListResult} 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 _list(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.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('/') ? '' : '/') + 'providers/microsoft.insights/operations'; - 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['OperationListResult']().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 Operations. */ -class Operations { - /** - * Create a Operations. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - } - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Lists all of the available operations from Microsoft.Insights provider. - * - * @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 {OperationListResult} - 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 OperationListResult} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - -} - -module.exports = Operations; diff --git a/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js b/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js deleted file mode 100644 index 7e523153c9..0000000000 --- a/lib/services/monitor/lib/lib/operations/tenantActivityLogs.js +++ /dev/null @@ -1,565 +0,0 @@ -/* - * 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; - -/** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 EventDataCollection} 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 _list(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 select = (options && options.select !== undefined) ? options.select : undefined; - let apiVersion = '2015-04-01'; - // Validate - try { - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); - } - if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { - throw new Error('select 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('/') ? '' : '/') + 'providers/microsoft.insights/eventtypes/management/values'; - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } - if (select !== null && select !== undefined) { - queryParameters.push('$select=' + encodeURIComponent(select)); - } - 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['EventDataCollection']().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); - }); -} - -/** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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 EventDataCollection} 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 _listNext(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['EventDataCollection']().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 TenantActivityLogs. */ -class TenantActivityLogs { - /** - * Create a TenantActivityLogs. - * @param {MonitorManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listNext = _listNext; - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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. - */ - listWithHttpOperationResponse(options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] Reduces the set of data collected.
The - * **$filter** is very restricted and allows only the following patterns.
- - * List events for a resource group: $filter=eventTimestamp ge '' - * and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - * and resourceGroupName eq ''.
- List events for - * resource: $filter=eventTimestamp ge '' and eventTimestamp le - * '' and eventChannels eq 'Admin, Operation' and resourceUri eq - * ''.
- List events for a subscription: $filter=eventTimestamp - * ge '' and eventTimestamp le '' and eventChannels eq - * 'Admin, Operation'.
- List events for a resource provider: - * $filter=eventTimestamp ge '' and eventTimestamp le '' - * and eventChannels eq 'Admin, Operation' and resourceProvider eq - * ''.
- List events for a correlation Id: - * api-version=2014-04-01&$filter=eventTimestamp ge - * '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - * '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - * correlationId eq ''.
**NOTE**: No other syntax is allowed. - * - * @param {string} [options.select] Used to fetch events with only the given - * properties.
The **$select** argument is a comma separated list of - * property names to be returned. Possible values are: *authorization*, - * *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, - * *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, - * *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, - * *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - list(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._list(options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._list(options, optionalCallback); - } - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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. - */ - listNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Gets the Activity Logs for the Tenant.
Everything that is applicable to - * the API to get the Activity Logs for the subscription is applicable to this - * API (the parameters, $filter, etc.).
One thing to point out here is that - * this API does *not* retrieve the logs at the individual subscription of the - * tenant but only surfaces the logs that were generated at the tenant level. - * - * @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 {EventDataCollection} - 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 EventDataCollection} 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. - */ - listNext(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._listNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listNext(nextPageLink, options, optionalCallback); - } - } - -} - -module.exports = TenantActivityLogs; diff --git a/lib/services/monitor/lib/package.json b/lib/services/monitor/lib/package.json deleted file mode 100644 index 7a880c0fcf..0000000000 --- a/lib/services/monitor/lib/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "azure-arm-monitor", - "author": "Microsoft Corporation", - "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "", - "dependencies": { - "ms-rest": "^2.3.3", - "ms-rest-azure": "^2.5.5" - }, - "keywords": [ "node", "azure" ], - "license": "MIT", - "main": "./lib/monitorManagementClient.js", - "types": "./lib/monitorManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", - "repository": { - "type": "git", - "url": "https://github.com/azure/azure-sdk-for-node.git" - }, - "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" - } -} 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/monitorManagementClient.d.ts b/lib/services/monitorManagement/lib/monitorManagementClient.d.ts index 23e746ef1e..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); diff --git a/lib/services/monitorManagement/lib/monitorManagementClient.js b/lib/services/monitorManagement/lib/monitorManagementClient.js index 7d0d15edd2..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) { 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 c0e34cb212..5d54214012 100644 --- a/lib/services/monitorManagement/package.json +++ b/lib/services/monitorManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-monitor", "author": "Microsoft Corporation", "description": "MonitorManagementClient Library with typescript type definitions for node", - "version": "2.0.0-preview", + "version": "3.0.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" @@ -14,12 +14,12 @@ "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" } }