diff --git a/codegen_mappings.json b/codegen_mappings.json index 712e1959bb..c63ff75963 100644 --- a/codegen_mappings.json +++ b/codegen_mappings.json @@ -24,6 +24,8 @@ "applicationinsights": { "resource-manager": { "packageName": "azure-arm-appinsights", + "packageVersion": "1.2.0-preview", + "generateReadmeMd": true, "dir": "applicationinsights", "source": "applicationinsights/resource-manager/readme.md" } diff --git a/lib/services/applicationinsights/LICENSE.txt b/lib/services/applicationinsights/LICENSE.txt index 0313a903d7..a70e8cf660 100644 --- a/lib/services/applicationinsights/LICENSE.txt +++ b/lib/services/applicationinsights/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 Microsoft +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 @@ -18,4 +18,4 @@ 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. \ No newline at end of file +SOFTWARE. diff --git a/lib/services/applicationinsights/README.md b/lib/services/applicationinsights/README.md index 426acfdaf1..b73a32a196 100644 --- a/lib/services/applicationinsights/README.md +++ b/lib/services/applicationinsights/README.md @@ -1,7 +1,9 @@ -# Microsoft Azure SDK for Node.js - AppLocationInsightsManagement +# Microsoft Azure SDK for Node.js - ApplicationInsightsManagementClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features -This project provides a Node.js package for accessing the Azure PAS. Right now it supports: -- **Node.js version: 6.x.x or higher** ## How to Install @@ -9,29 +11,24 @@ This project provides a Node.js package for accessing the Azure PAS. Right now i npm install azure-arm-appinsights ``` -## How to Use - -### Authentication, client creation and listing components as an example - - ```javascript - var msRestAzure = require('ms-rest-azure'); - var appInsights = require("azure-arm-appinsights"); - - // 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(function(err, credentials) { - let client = new appInsights(credentials, 'your-subscription-id'); - client.components.list().then((operations) => { - console.log('List of components:'); - console.dir(components, {depth: null, colors: true}); - }); - }).catch((err) => { - console.log('An error ocurred'); - console.dir(err, {depth: null, colors: true}); - }); +## How to use + +### Authentication, client creation and list operations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ApplicationInsightsManagementClient = require("azure-arm-appinsights"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ApplicationInsightsManagementClient(creds, subscriptionId); + return client.operations.list().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 diff --git a/lib/services/applicationinsights/lib/applicationInsightsManagementClient.d.ts b/lib/services/applicationinsights/lib/applicationInsightsManagementClient.d.ts index f8514b88b8..591f23f282 100644 --- a/lib/services/applicationinsights/lib/applicationInsightsManagementClient.d.ts +++ b/lib/services/applicationinsights/lib/applicationInsightsManagementClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class ApplicationInsightsManagementClient extends AzureServiceClient { +export default class ApplicationInsightsManagementClient extends AzureServiceClient { /** * Initializes a new instance of the ApplicationInsightsManagementClient class. * @constructor @@ -56,12 +57,20 @@ declare class ApplicationInsightsManagementClient extends AzureServiceClient { // Operation groups operations: operations.Operations; - components: operations.Components; - webTests: operations.WebTests; + annotations: operations.Annotations; + aPIKeys: operations.APIKeys; exportConfigurations: operations.ExportConfigurations; componentCurrentBillingFeatures: operations.ComponentCurrentBillingFeatures; componentQuotaStatus: operations.ComponentQuotaStatus; - aPIKeys: operations.APIKeys; + componentFeatureCapabilities: operations.ComponentFeatureCapabilities; + componentAvailableFeatures: operations.ComponentAvailableFeatures; + proactiveDetectionConfigurations: operations.ProactiveDetectionConfigurations; + components: operations.Components; + workItemConfigurations: operations.WorkItemConfigurations; + favorites: operations.Favorites; + favorite: operations.Favorite; + webTestLocations: operations.WebTestLocations; + webTests: operations.WebTests; } -export = ApplicationInsightsManagementClient; +export { ApplicationInsightsManagementClient, models as ApplicationInsightsManagementModels }; diff --git a/lib/services/applicationinsights/lib/applicationInsightsManagementClient.js b/lib/services/applicationinsights/lib/applicationInsightsManagementClient.js index 69dcf7bdda..569f27230c 100644 --- a/lib/services/applicationinsights/lib/applicationInsightsManagementClient.js +++ b/lib/services/applicationinsights/lib/applicationInsightsManagementClient.js @@ -73,12 +73,20 @@ class ApplicationInsightsManagementClient extends ServiceClient { this.generateClientRequestId = options.generateClientRequestId; } this.operations = new operations.Operations(this); - this.components = new operations.Components(this); - this.webTests = new operations.WebTests(this); + this.annotations = new operations.Annotations(this); + this.aPIKeys = new operations.APIKeys(this); this.exportConfigurations = new operations.ExportConfigurations(this); this.componentCurrentBillingFeatures = new operations.ComponentCurrentBillingFeatures(this); this.componentQuotaStatus = new operations.ComponentQuotaStatus(this); - this.aPIKeys = new operations.APIKeys(this); + this.componentFeatureCapabilities = new operations.ComponentFeatureCapabilities(this); + this.componentAvailableFeatures = new operations.ComponentAvailableFeatures(this); + this.proactiveDetectionConfigurations = new operations.ProactiveDetectionConfigurations(this); + this.components = new operations.Components(this); + this.workItemConfigurations = new operations.WorkItemConfigurations(this); + this.favorites = new operations.Favorites(this); + this.favorite = new operations.Favorite(this); + this.webTestLocations = new operations.WebTestLocations(this); + this.webTests = new operations.WebTests(this); this.models = models; msRest.addSerializationMixin(this); } @@ -86,3 +94,6 @@ class ApplicationInsightsManagementClient extends ServiceClient { } module.exports = ApplicationInsightsManagementClient; +module.exports['default'] = ApplicationInsightsManagementClient; +module.exports.ApplicationInsightsManagementClient = ApplicationInsightsManagementClient; +module.exports.ApplicationInsightsManagementModels = models; diff --git a/lib/services/applicationinsights/lib/models/annotation.js b/lib/services/applicationinsights/lib/models/annotation.js new file mode 100644 index 0000000000..49216c72a4 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/annotation.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'; + +/** + * Annotation associated with an application insights resource. + * + */ +class Annotation { + /** + * Create a Annotation. + * @member {string} [annotationName] Name of annotation + * @member {string} [category] Category of annotation, free form + * @member {date} [eventTime] Time when event occurred + * @member {string} [id] Unique Id for annotation + * @member {string} [properties] Serialized JSON object for detailed + * properties + * @member {string} [relatedAnnotation] Related parent annotation if any. + * Default value: 'null' . + */ + constructor() { + } + + /** + * Defines the metadata of Annotation + * + * @returns {object} metadata of Annotation + * + */ + mapper() { + return { + required: false, + serializedName: 'Annotation', + type: { + name: 'Composite', + className: 'Annotation', + modelProperties: { + annotationName: { + required: false, + serializedName: 'AnnotationName', + type: { + name: 'String' + } + }, + category: { + required: false, + serializedName: 'Category', + type: { + name: 'String' + } + }, + eventTime: { + required: false, + serializedName: 'EventTime', + type: { + name: 'DateTime' + } + }, + id: { + required: false, + serializedName: 'Id', + type: { + name: 'String' + } + }, + properties: { + required: false, + serializedName: 'Properties', + type: { + name: 'String' + } + }, + relatedAnnotation: { + required: false, + serializedName: 'RelatedAnnotation', + defaultValue: 'null', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Annotation; diff --git a/lib/services/applicationinsights/lib/models/annotationError.js b/lib/services/applicationinsights/lib/models/annotationError.js new file mode 100644 index 0000000000..4b9fc68492 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/annotationError.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'; + +const models = require('./index'); + +/** + * Error associated with trying to create annotation with Id that already exist + * + */ +class AnnotationError { + /** + * Create a AnnotationError. + * @member {string} [code] Error detail code and explanation + * @member {string} [message] Error message + * @member {object} [innererror] + * @member {string} [innererror.diagnosticcontext] Provides correlation for + * request + * @member {date} [innererror.time] Request time + */ + constructor() { + } + + /** + * Defines the metadata of AnnotationError + * + * @returns {object} metadata of AnnotationError + * + */ + mapper() { + return { + required: false, + serializedName: 'AnnotationError', + type: { + name: 'Composite', + className: 'AnnotationError', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + innererror: { + required: false, + serializedName: 'innererror', + type: { + name: 'Composite', + className: 'InnerError' + } + } + } + } + }; + } +} + +module.exports = AnnotationError; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentAvailableFeatures.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentAvailableFeatures.js new file mode 100644 index 0000000000..8867f4e048 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentAvailableFeatures.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 Application Insights component available features. + * + */ +class ApplicationInsightsComponentAvailableFeatures { + /** + * Create a ApplicationInsightsComponentAvailableFeatures. + * @member {array} [result] A list of Application Insigths component feature. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentAvailableFeatures + * + * @returns {object} metadata of ApplicationInsightsComponentAvailableFeatures + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentAvailableFeatures', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentAvailableFeatures', + modelProperties: { + result: { + required: false, + readOnly: true, + serializedName: 'Result', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationInsightsComponentFeatureElementType', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFeature' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentAvailableFeatures; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentFavorite.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFavorite.js new file mode 100644 index 0000000000..3b4372c28c --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFavorite.js @@ -0,0 +1,157 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Properties that define a favorite that is associated to an Application + * Insights component. + * + */ +class ApplicationInsightsComponentFavorite { + /** + * Create a ApplicationInsightsComponentFavorite. + * @member {string} [name] The user-defined name of the favorite. + * @member {string} [config] Configuration of this particular favorite, which + * are driven by the Azure portal UX. Configuration data is a string + * containing valid JSON + * @member {string} [version] This instance's version of the data model. This + * can change as new features are added that can be marked favorite. Current + * examples include MetricsExplorer (ME) and Search. + * @member {string} [favoriteId] Internally assigned unique id of the + * favorite definition. + * @member {string} [favoriteType] Enum indicating if this favorite + * definition is owned by a specific user or is shared between all users with + * access to the Application Insights component. Possible values include: + * 'shared', 'user' + * @member {string} [sourceType] The source of the favorite definition. + * @member {string} [timeModified] Date and time in UTC of the last + * modification that was made to this favorite definition. + * @member {array} [tags] A list of 0 or more tags that are associated with + * this favorite definition + * @member {string} [category] Favorite category, as defined by the user at + * creation time. + * @member {boolean} [isGeneratedFromTemplate] Flag denoting wether or not + * this favorite was generated from a template. + * @member {string} [userId] Unique user id of the specific user that owns + * this favorite. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentFavorite + * + * @returns {object} metadata of ApplicationInsightsComponentFavorite + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentFavorite', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFavorite', + modelProperties: { + name: { + required: false, + serializedName: 'Name', + type: { + name: 'String' + } + }, + config: { + required: false, + serializedName: 'Config', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'Version', + type: { + name: 'String' + } + }, + favoriteId: { + required: false, + readOnly: true, + serializedName: 'FavoriteId', + type: { + name: 'String' + } + }, + favoriteType: { + required: false, + serializedName: 'FavoriteType', + type: { + name: 'Enum', + allowedValues: [ 'shared', 'user' ] + } + }, + sourceType: { + required: false, + serializedName: 'SourceType', + type: { + name: 'String' + } + }, + timeModified: { + required: false, + readOnly: true, + serializedName: 'TimeModified', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'Tags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + category: { + required: false, + serializedName: 'Category', + type: { + name: 'String' + } + }, + isGeneratedFromTemplate: { + required: false, + serializedName: 'IsGeneratedFromTemplate', + type: { + name: 'Boolean' + } + }, + userId: { + required: false, + readOnly: true, + serializedName: 'UserId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentFavorite; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeature.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeature.js new file mode 100644 index 0000000000..e7fbc07c23 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeature.js @@ -0,0 +1,139 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 Application Insights component daily data volume cap status + * + */ +class ApplicationInsightsComponentFeature { + /** + * Create a ApplicationInsightsComponentFeature. + * @member {string} [featureName] The pricing feature name. + * @member {string} [meterId] The meter id used for the feature. + * @member {string} [meterRateFrequency] The meter meter rate for the + * feature's meter. + * @member {string} [resouceId] Reserved, not used now. + * @member {boolean} [isHidden] Reserved, not used now. + * @member {array} [capabilities] A list of Application Insigths component + * feature capability. + * @member {string} [title] Desplay name of the feature. + * @member {boolean} [isMainFeature] Whether can apply addon feature on to + * it. + * @member {string} [supportedAddonFeatures] The add on features on main + * feature. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentFeature + * + * @returns {object} metadata of ApplicationInsightsComponentFeature + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentFeature', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFeature', + modelProperties: { + featureName: { + required: false, + readOnly: true, + serializedName: 'FeatureName', + type: { + name: 'String' + } + }, + meterId: { + required: false, + readOnly: true, + serializedName: 'MeterId', + type: { + name: 'String' + } + }, + meterRateFrequency: { + required: false, + readOnly: true, + serializedName: 'MeterRateFrequency', + type: { + name: 'String' + } + }, + resouceId: { + required: false, + readOnly: true, + serializedName: 'ResouceId', + type: { + name: 'String' + } + }, + isHidden: { + required: false, + readOnly: true, + serializedName: 'IsHidden', + type: { + name: 'Boolean' + } + }, + capabilities: { + required: false, + readOnly: true, + serializedName: 'Capabilities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationInsightsComponentFeatureCapabilityElementType', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFeatureCapability' + } + } + } + }, + title: { + required: false, + readOnly: true, + serializedName: 'Title', + type: { + name: 'String' + } + }, + isMainFeature: { + required: false, + readOnly: true, + serializedName: 'IsMainFeature', + type: { + name: 'Boolean' + } + }, + supportedAddonFeatures: { + required: false, + readOnly: true, + serializedName: 'SupportedAddonFeatures', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentFeature; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeatureCapabilities.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeatureCapabilities.js new file mode 100644 index 0000000000..ae93319d27 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeatureCapabilities.js @@ -0,0 +1,192 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 Application Insights component feature capabilities + * + */ +class ApplicationInsightsComponentFeatureCapabilities { + /** + * Create a ApplicationInsightsComponentFeatureCapabilities. + * @member {boolean} [supportExportData] Whether allow to use continuous + * export feature. + * @member {string} [burstThrottlePolicy] Reserved, not used now. + * @member {string} [metadataClass] Reserved, not used now. + * @member {boolean} [liveStreamMetrics] Reserved, not used now. + * @member {boolean} [applicationMap] Reserved, not used now. + * @member {boolean} [workItemIntegration] Whether allow to use work item + * integration feature. + * @member {boolean} [powerBIIntegration] Reserved, not used now. + * @member {boolean} [openSchema] Reserved, not used now. + * @member {boolean} [proactiveDetection] Reserved, not used now. + * @member {boolean} [analyticsIntegration] Reserved, not used now. + * @member {boolean} [multipleStepWebTest] Whether allow to use multiple + * steps web test feature. + * @member {string} [apiAccessLevel] Reserved, not used now. + * @member {string} [trackingType] The applciation insights component used + * tracking type. + * @member {number} [dailyCap] Daily data volume cap in GB. + * @member {number} [dailyCapResetTime] Daily data volume cap UTC reset hour. + * @member {number} [throttleRate] Reserved, not used now. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentFeatureCapabilities + * + * @returns {object} metadata of ApplicationInsightsComponentFeatureCapabilities + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentFeatureCapabilities', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFeatureCapabilities', + modelProperties: { + supportExportData: { + required: false, + readOnly: true, + serializedName: 'SupportExportData', + type: { + name: 'Boolean' + } + }, + burstThrottlePolicy: { + required: false, + readOnly: true, + serializedName: 'BurstThrottlePolicy', + type: { + name: 'String' + } + }, + metadataClass: { + required: false, + readOnly: true, + serializedName: 'MetadataClass', + type: { + name: 'String' + } + }, + liveStreamMetrics: { + required: false, + readOnly: true, + serializedName: 'LiveStreamMetrics', + type: { + name: 'Boolean' + } + }, + applicationMap: { + required: false, + readOnly: true, + serializedName: 'ApplicationMap', + type: { + name: 'Boolean' + } + }, + workItemIntegration: { + required: false, + readOnly: true, + serializedName: 'WorkItemIntegration', + type: { + name: 'Boolean' + } + }, + powerBIIntegration: { + required: false, + readOnly: true, + serializedName: 'PowerBIIntegration', + type: { + name: 'Boolean' + } + }, + openSchema: { + required: false, + readOnly: true, + serializedName: 'OpenSchema', + type: { + name: 'Boolean' + } + }, + proactiveDetection: { + required: false, + readOnly: true, + serializedName: 'ProactiveDetection', + type: { + name: 'Boolean' + } + }, + analyticsIntegration: { + required: false, + readOnly: true, + serializedName: 'AnalyticsIntegration', + type: { + name: 'Boolean' + } + }, + multipleStepWebTest: { + required: false, + readOnly: true, + serializedName: 'MultipleStepWebTest', + type: { + name: 'Boolean' + } + }, + apiAccessLevel: { + required: false, + readOnly: true, + serializedName: 'ApiAccessLevel', + type: { + name: 'String' + } + }, + trackingType: { + required: false, + readOnly: true, + serializedName: 'TrackingType', + type: { + name: 'String' + } + }, + dailyCap: { + required: false, + readOnly: true, + serializedName: 'DailyCap', + type: { + name: 'Number' + } + }, + dailyCapResetTime: { + required: false, + readOnly: true, + serializedName: 'DailyCapResetTime', + type: { + name: 'Number' + } + }, + throttleRate: { + required: false, + readOnly: true, + serializedName: 'ThrottleRate', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentFeatureCapabilities; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeatureCapability.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeatureCapability.js new file mode 100644 index 0000000000..5499022ffb --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentFeatureCapability.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'; + +/** + * An Application Insights component feature capability + * + */ +class ApplicationInsightsComponentFeatureCapability { + /** + * Create a ApplicationInsightsComponentFeatureCapability. + * @member {string} [name] The name of the capability. + * @member {string} [description] The description of the capability. + * @member {string} [value] The vaule of the capability. + * @member {string} [unit] The unit of the capability. + * @member {string} [meterId] The meter used for the capability. + * @member {string} [meterRateFrequency] The meter rate of the meter. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentFeatureCapability + * + * @returns {object} metadata of ApplicationInsightsComponentFeatureCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentFeatureCapability', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFeatureCapability', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'Name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'Description', + type: { + name: 'String' + } + }, + value: { + required: false, + readOnly: true, + serializedName: 'Value', + type: { + name: 'String' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'Unit', + type: { + name: 'String' + } + }, + meterId: { + required: false, + readOnly: true, + serializedName: 'MeterId', + type: { + name: 'String' + } + }, + meterRateFrequency: { + required: false, + readOnly: true, + serializedName: 'MeterRateFrequency', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentFeatureCapability; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentProactiveDetectionConfiguration.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentProactiveDetectionConfiguration.js new file mode 100644 index 0000000000..1c6090fea1 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentProactiveDetectionConfiguration.js @@ -0,0 +1,123 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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'); + +/** + * Properties that define a ProactiveDetection configuration. + * + * @extends models['BaseResource'] + */ +class ApplicationInsightsComponentProactiveDetectionConfiguration extends models['BaseResource'] { + /** + * Create a ApplicationInsightsComponentProactiveDetectionConfiguration. + * @member {string} [name] The rule name + * @member {boolean} [enabled] A flag that indicates whether this rule is + * enabled by the user + * @member {boolean} [sendEmailsToSubscriptionOwners] A flag that indicated + * whether notifications on this rule should be sent to subscription owners + * @member {array} [customEmails] Custom email addresses for this rule + * notifications + * @member {string} [lastUpdatedTime] The last time this rule was updated + * @member {object} [ruleDefinitions] Static definitions of the + * ProactiveDetection configuration rule (same values for all components). + * @member {string} [ruleDefinitions.name] The rule name + * @member {string} [ruleDefinitions.displayName] The rule name as it is + * displayed in UI + * @member {string} [ruleDefinitions.description] The rule description + * @member {string} [ruleDefinitions.helpUrl] URL which displays aditional + * info about the proactive detection rule + * @member {boolean} [ruleDefinitions.isHidden] A flag indicating whether the + * rule is hidden (from the UI) + * @member {boolean} [ruleDefinitions.isEnabledByDefault] A flag indicating + * whether the rule is enabled by default + * @member {boolean} [ruleDefinitions.isInPreview] A flag indicating whether + * the rule is in preview + * @member {boolean} [ruleDefinitions.supportsEmailNotifications] A flag + * indicating whether email notifications are supported for detections for + * this rule + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationInsightsComponentProactiveDetectionConfiguration + * + * @returns {object} metadata of ApplicationInsightsComponentProactiveDetectionConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentProactiveDetectionConfiguration', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentProactiveDetectionConfiguration', + modelProperties: { + name: { + required: false, + serializedName: 'Name', + type: { + name: 'String' + } + }, + enabled: { + required: false, + serializedName: 'Enabled', + type: { + name: 'Boolean' + } + }, + sendEmailsToSubscriptionOwners: { + required: false, + serializedName: 'SendEmailsToSubscriptionOwners', + type: { + name: 'Boolean' + } + }, + customEmails: { + required: false, + serializedName: 'CustomEmails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + lastUpdatedTime: { + required: false, + serializedName: 'LastUpdatedTime', + type: { + name: 'String' + } + }, + ruleDefinitions: { + required: false, + serializedName: 'RuleDefinitions', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentProactiveDetectionConfiguration; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.js new file mode 100644 index 0000000000..b4b3187eac --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.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'; + +/** + * Static definitions of the ProactiveDetection configuration rule (same values + * for all components). + * + */ +class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions { + /** + * Create a ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions. + * @member {string} [name] The rule name + * @member {string} [displayName] The rule name as it is displayed in UI + * @member {string} [description] The rule description + * @member {string} [helpUrl] URL which displays aditional info about the + * proactive detection rule + * @member {boolean} [isHidden] A flag indicating whether the rule is hidden + * (from the UI) + * @member {boolean} [isEnabledByDefault] A flag indicating whether the rule + * is enabled by default + * @member {boolean} [isInPreview] A flag indicating whether the rule is in + * preview + * @member {boolean} [supportsEmailNotifications] A flag indicating whether + * email notifications are supported for detections for this rule + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + * + * @returns {object} metadata of ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentProactiveDetectionConfiguration_RuleDefinitions', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions', + modelProperties: { + name: { + required: false, + serializedName: 'Name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'DisplayName', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'Description', + type: { + name: 'String' + } + }, + helpUrl: { + required: false, + serializedName: 'HelpUrl', + type: { + name: 'String' + } + }, + isHidden: { + required: false, + serializedName: 'IsHidden', + type: { + name: 'Boolean' + } + }, + isEnabledByDefault: { + required: false, + serializedName: 'IsEnabledByDefault', + type: { + name: 'Boolean' + } + }, + isInPreview: { + required: false, + serializedName: 'IsInPreview', + type: { + name: 'Boolean' + } + }, + supportsEmailNotifications: { + required: false, + serializedName: 'SupportsEmailNotifications', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsComponentWebTestLocation.js b/lib/services/applicationinsights/lib/models/applicationInsightsComponentWebTestLocation.js new file mode 100644 index 0000000000..00a5d48ac1 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsComponentWebTestLocation.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'; + +/** + * Properties that define a web test location available to an Application + * Insights Component. + * + */ +class ApplicationInsightsComponentWebTestLocation { + /** + * Create a ApplicationInsightsComponentWebTestLocation. + * @member {string} [displayName] The display name of the web test location. + * @member {string} [tag] Internally defined geographic location tag. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationInsightsComponentWebTestLocation + * + * @returns {object} metadata of ApplicationInsightsComponentWebTestLocation + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsComponentWebTestLocation', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentWebTestLocation', + modelProperties: { + displayName: { + required: false, + readOnly: true, + serializedName: 'DisplayName', + type: { + name: 'String' + } + }, + tag: { + required: false, + readOnly: true, + serializedName: 'Tag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsComponentWebTestLocation; diff --git a/lib/services/applicationinsights/lib/models/applicationInsightsWebTestLocationsListResult.js b/lib/services/applicationinsights/lib/models/applicationInsightsWebTestLocationsListResult.js new file mode 100644 index 0000000000..8d05b47c26 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/applicationInsightsWebTestLocationsListResult.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'; + +/** + * Describes the list of web test locations available to an Application + * Insights Component. + */ +class ApplicationInsightsWebTestLocationsListResult extends Array { + /** + * Create a ApplicationInsightsWebTestLocationsListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationInsightsWebTestLocationsListResult + * + * @returns {object} metadata of ApplicationInsightsWebTestLocationsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationInsightsWebTestLocationsListResult', + type: { + name: 'Composite', + className: 'ApplicationInsightsWebTestLocationsListResult', + modelProperties: { + value: { + required: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationInsightsComponentWebTestLocationElementType', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentWebTestLocation' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationInsightsWebTestLocationsListResult; diff --git a/lib/services/applicationinsights/lib/models/componentPurgeBody.js b/lib/services/applicationinsights/lib/models/componentPurgeBody.js new file mode 100644 index 0000000000..14b09d26d4 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/componentPurgeBody.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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'); + +/** + * Describes the body of a purge request for an App Insights component + * + */ +class ComponentPurgeBody { + /** + * Create a ComponentPurgeBody. + * @member {string} table Table from which to purge data. + * @member {array} filters The set of columns and filters (queries) to run + * over them to purge the resulting data. + */ + constructor() { + } + + /** + * Defines the metadata of ComponentPurgeBody + * + * @returns {object} metadata of ComponentPurgeBody + * + */ + mapper() { + return { + required: false, + serializedName: 'ComponentPurgeBody', + type: { + name: 'Composite', + className: 'ComponentPurgeBody', + modelProperties: { + table: { + required: true, + serializedName: 'table', + type: { + name: 'String' + } + }, + filters: { + required: true, + serializedName: 'filters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ComponentPurgeBodyFiltersElementType', + type: { + name: 'Composite', + className: 'ComponentPurgeBodyFilters' + } + } + } + } + } + } + }; + } +} + +module.exports = ComponentPurgeBody; diff --git a/lib/services/applicationinsights/lib/models/componentPurgeBodyFilters.js b/lib/services/applicationinsights/lib/models/componentPurgeBodyFilters.js new file mode 100644 index 0000000000..832ecedb3f --- /dev/null +++ b/lib/services/applicationinsights/lib/models/componentPurgeBodyFilters.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'; + +/** + * User-defined filters to return data which will be purged from the table. + * + */ +class ComponentPurgeBodyFilters { + /** + * Create a ComponentPurgeBodyFilters. + * @member {string} [column] The column of the table over which the given + * query should run + * @member {string} [filter] A query to to run over the provided table and + * column to purge the corresponding data. + */ + constructor() { + } + + /** + * Defines the metadata of ComponentPurgeBodyFilters + * + * @returns {object} metadata of ComponentPurgeBodyFilters + * + */ + mapper() { + return { + required: false, + serializedName: 'ComponentPurgeBodyFilters', + type: { + name: 'Composite', + className: 'ComponentPurgeBodyFilters', + modelProperties: { + column: { + required: false, + serializedName: 'column', + type: { + name: 'String' + } + }, + filter: { + required: false, + serializedName: 'filter', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ComponentPurgeBodyFilters; diff --git a/lib/services/applicationinsights/lib/models/componentPurgeResponse.js b/lib/services/applicationinsights/lib/models/componentPurgeResponse.js new file mode 100644 index 0000000000..ef796df507 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/componentPurgeResponse.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'; + +/** + * Response containing operationId for a specific purge action. + * + */ +class ComponentPurgeResponse { + /** + * Create a ComponentPurgeResponse. + * @member {string} operationId Id to use when querying for status for a + * particular purge operation. + */ + constructor() { + } + + /** + * Defines the metadata of ComponentPurgeResponse + * + * @returns {object} metadata of ComponentPurgeResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ComponentPurgeResponse', + type: { + name: 'Composite', + className: 'ComponentPurgeResponse', + modelProperties: { + operationId: { + required: true, + serializedName: 'operationId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ComponentPurgeResponse; diff --git a/lib/services/applicationinsights/lib/models/componentPurgeStatusResponse.js b/lib/services/applicationinsights/lib/models/componentPurgeStatusResponse.js new file mode 100644 index 0000000000..47b5b6ec49 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/componentPurgeStatusResponse.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'; + +/** + * Response containing status for a specific purge operation. + * + */ +class ComponentPurgeStatusResponse { + /** + * Create a ComponentPurgeStatusResponse. + * @member {string} status Status of the operation represented by the + * requested Id. Possible values include: 'Pending', 'Completed' + */ + constructor() { + } + + /** + * Defines the metadata of ComponentPurgeStatusResponse + * + * @returns {object} metadata of ComponentPurgeStatusResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ComponentPurgeStatusResponse', + type: { + name: 'Composite', + className: 'ComponentPurgeStatusResponse', + modelProperties: { + status: { + required: true, + serializedName: 'status', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ComponentPurgeStatusResponse; diff --git a/lib/services/applicationinsights/lib/models/index.d.ts b/lib/services/applicationinsights/lib/models/index.d.ts index 936ca72d22..61a467092e 100644 --- a/lib/services/applicationinsights/lib/models/index.d.ts +++ b/lib/services/applicationinsights/lib/models/index.d.ts @@ -70,167 +70,102 @@ export interface Operation { /** * @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 TagsResource class. + * Initializes a new instance of the Annotation class. * @constructor - * A container holding only the Tags for a resource, allowing the user to - * update the tags on a WebTest instance. + * Annotation associated with an application insights resource. * - * @member {object} [tags] Resource tags + * @member {string} [annotationName] Name of annotation + * @member {string} [category] Category of annotation, free form + * @member {date} [eventTime] Time when event occurred + * @member {string} [id] Unique Id for annotation + * @member {string} [properties] Serialized JSON object for detailed properties + * @member {string} [relatedAnnotation] Related parent annotation if any. + * Default value: 'null' . */ -export interface TagsResource { - tags?: { [propertyName: string]: string }; +export interface Annotation { + annotationName?: string; + category?: string; + eventTime?: Date; + id?: string; + properties?: string; + relatedAnnotation?: string; } /** * @class - * Initializes a new instance of the ApplicationInsightsComponent class. + * Initializes a new instance of the InnerError class. * @constructor - * An Application Insights component definition. + * Inner error * - * @member {string} kind The kind of application that this component refers to, - * used to customize UI. This value is a freeform string, values should - * typically be one of the following: web, ios, other, store, java, phone. - * @member {string} [applicationId] The unique ID of your application. This - * field mirrors the 'Name' field and cannot be changed. - * @member {string} [appId] Application Insights Unique ID for your - * Application. - * @member {string} applicationType Type of application being monitored. - * Possible values include: 'web', 'other'. Default value: 'web' . - * @member {string} [flowType] Used by the Application Insights system to - * determine what kind of flow this component was created by. This is to be set - * to 'Bluefield' when creating/updating a component via the REST API. Possible - * values include: 'Bluefield'. Default value: 'Bluefield' . - * @member {string} [requestSource] Describes what tool created this - * Application Insights component. Customers using this API should set this to - * the default 'rest'. Possible values include: 'rest'. Default value: 'rest' . - * @member {string} [instrumentationKey] Application Insights Instrumentation - * key. A read-only value that applications can use to identify the destination - * for all telemetry sent to Azure Application Insights. This value will be - * supplied upon construction of each new Application Insights component. - * @member {date} [creationDate] Creation Date for the Application Insights - * component, in ISO 8601 format. - * @member {string} [tenantId] Azure Tenant Id. - * @member {string} [hockeyAppId] The unique application ID created when a new - * application is added to HockeyApp, used for communications with HockeyApp. - * @member {string} [hockeyAppToken] Token used to authenticate communications - * with between Application Insights and HockeyApp. - * @member {string} [provisioningState] Current state of this component: - * whether or not is has been provisioned within the resource group it is - * defined. Users cannot change this value but are able to read from it. Values - * will include Succeeded, Deploying, Canceled, and Failed. - * @member {number} [samplingPercentage] Percentage of the data produced by the - * application being monitored that is being sampled for Application Insights - * telemetry. + * @member {string} [diagnosticcontext] Provides correlation for request + * @member {date} [time] Request time */ -export interface ApplicationInsightsComponent extends Resource { - kind: string; - readonly applicationId?: string; - readonly appId?: string; - applicationType: string; - flowType?: string; - requestSource?: string; - readonly instrumentationKey?: string; - readonly creationDate?: Date; - readonly tenantId?: string; - hockeyAppId?: string; - readonly hockeyAppToken?: string; - readonly provisioningState?: string; - samplingPercentage?: number; +export interface InnerError { + diagnosticcontext?: string; + time?: Date; } /** * @class - * Initializes a new instance of the WebTestGeolocation class. + * Initializes a new instance of the AnnotationError class. * @constructor - * Geo-physical location to run a web test from. You must specify one or more - * locations for the test to run from. + * Error associated with trying to create annotation with Id that already exist * - * @member {string} [location] Location ID for the webtest to run from. + * @member {string} [code] Error detail code and explanation + * @member {string} [message] Error message + * @member {object} [innererror] + * @member {string} [innererror.diagnosticcontext] Provides correlation for + * request + * @member {date} [innererror.time] Request time */ -export interface WebTestGeolocation { - location?: string; +export interface AnnotationError { + code?: string; + message?: string; + innererror?: InnerError; } /** * @class - * Initializes a new instance of the WebTestPropertiesConfiguration class. + * Initializes a new instance of the APIKeyRequest class. * @constructor - * An XML configuration specification for a WebTest. + * An Application Insights component API Key createion request definition. * - * @member {string} [webTest] The XML specification of a WebTest to run against - * an application. + * @member {string} [name] The name of the API Key. + * @member {array} [linkedReadProperties] The read access rights of this API + * Key. + * @member {array} [linkedWriteProperties] The write access rights of this API + * Key. */ -export interface WebTestPropertiesConfiguration { - webTest?: string; +export interface APIKeyRequest { + name?: string; + linkedReadProperties?: string[]; + linkedWriteProperties?: string[]; } /** * @class - * Initializes a new instance of the WebTest class. + * Initializes a new instance of the ApplicationInsightsComponentAPIKey class. * @constructor - * An Application Insights web test definition. + * Properties that define an API key of an Application Insights Component. * - * @member {string} [kind] The kind of web test that this web test watches. - * Choices are ping and multistep. Possible values include: 'ping', - * 'multistep'. Default value: 'ping' . - * @member {string} syntheticMonitorId Unique ID of this WebTest. This is - * typically the same value as the Name field. - * @member {string} webTestName User defined name if this WebTest. - * @member {string} [description] Purpose/user defined descriptive test for - * this WebTest. - * @member {boolean} [enabled] Is the test actively being monitored. - * @member {number} [frequency] Interval in seconds between test runs for this - * WebTest. Default value is 300. Default value: 300 . - * @member {number} [timeout] Seconds until this WebTest will timeout and fail. - * Default value is 30. Default value: 30 . - * @member {string} webTestKind The kind of web test this is, valid choices are - * ping and multistep. Possible values include: 'ping', 'multistep'. Default - * value: 'ping' . - * @member {boolean} [retryEnabled] Allow for retries should this WebTest fail. - * @member {array} locations A list of where to physically run the tests from - * to give global coverage for accessibility of your application. - * @member {object} [configuration] An XML configuration specification for a - * WebTest. - * @member {string} [configuration.webTest] The XML specification of a WebTest - * to run against an application. - * @member {string} [provisioningState] Current state of this component, - * whether or not is has been provisioned within the resource group it is - * defined. Users cannot change this value but are able to read from it. Values - * will include Succeeded, Deploying, Canceled, and Failed. + * @member {string} [id] The unique ID of the API key inside an Applciation + * Insights component. It is auto generated when the API key is created. + * @member {string} [apiKey] The API key value. It will be only return once + * when the API Key was created. + * @member {string} [createdDate] The create date of this API key. + * @member {string} [name] The name of the API key. + * @member {array} [linkedReadProperties] The read access rights of this API + * Key. + * @member {array} [linkedWriteProperties] The write access rights of this API + * Key. */ -export interface WebTest extends Resource { - kind?: string; - syntheticMonitorId: string; - webTestName: string; - description?: string; - enabled?: boolean; - frequency?: number; - timeout?: number; - webTestKind: string; - retryEnabled?: boolean; - locations: WebTestGeolocation[]; - configuration?: WebTestPropertiesConfiguration; - readonly provisioningState?: string; +export interface ApplicationInsightsComponentAPIKey { + readonly id?: string; + readonly apiKey?: string; + createdDate?: string; + name?: string; + linkedReadProperties?: string[]; + linkedWriteProperties?: string[]; } /** @@ -414,46 +349,531 @@ export interface ApplicationInsightsComponentQuotaStatus { /** * @class - * Initializes a new instance of the APIKeyRequest class. + * Initializes a new instance of the ApplicationInsightsComponentFeatureCapabilities class. * @constructor - * An Application Insights component API Key createion request definition. + * An Application Insights component feature capabilities * - * @member {string} [name] The name of the API Key. - * @member {array} [linkedReadProperties] The read access rights of this API - * Key. - * @member {array} [linkedWriteProperties] The write access rights of this API - * Key. + * @member {boolean} [supportExportData] Whether allow to use continuous export + * feature. + * @member {string} [burstThrottlePolicy] Reserved, not used now. + * @member {string} [metadataClass] Reserved, not used now. + * @member {boolean} [liveStreamMetrics] Reserved, not used now. + * @member {boolean} [applicationMap] Reserved, not used now. + * @member {boolean} [workItemIntegration] Whether allow to use work item + * integration feature. + * @member {boolean} [powerBIIntegration] Reserved, not used now. + * @member {boolean} [openSchema] Reserved, not used now. + * @member {boolean} [proactiveDetection] Reserved, not used now. + * @member {boolean} [analyticsIntegration] Reserved, not used now. + * @member {boolean} [multipleStepWebTest] Whether allow to use multiple steps + * web test feature. + * @member {string} [apiAccessLevel] Reserved, not used now. + * @member {string} [trackingType] The applciation insights component used + * tracking type. + * @member {number} [dailyCap] Daily data volume cap in GB. + * @member {number} [dailyCapResetTime] Daily data volume cap UTC reset hour. + * @member {number} [throttleRate] Reserved, not used now. */ -export interface APIKeyRequest { +export interface ApplicationInsightsComponentFeatureCapabilities { + readonly supportExportData?: boolean; + readonly burstThrottlePolicy?: string; + readonly metadataClass?: string; + readonly liveStreamMetrics?: boolean; + readonly applicationMap?: boolean; + readonly workItemIntegration?: boolean; + readonly powerBIIntegration?: boolean; + readonly openSchema?: boolean; + readonly proactiveDetection?: boolean; + readonly analyticsIntegration?: boolean; + readonly multipleStepWebTest?: boolean; + readonly apiAccessLevel?: string; + readonly trackingType?: string; + readonly dailyCap?: number; + readonly dailyCapResetTime?: number; + readonly throttleRate?: number; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentFeatureCapability class. + * @constructor + * An Application Insights component feature capability + * + * @member {string} [name] The name of the capability. + * @member {string} [description] The description of the capability. + * @member {string} [value] The vaule of the capability. + * @member {string} [unit] The unit of the capability. + * @member {string} [meterId] The meter used for the capability. + * @member {string} [meterRateFrequency] The meter rate of the meter. + */ +export interface ApplicationInsightsComponentFeatureCapability { + readonly name?: string; + readonly description?: string; + readonly value?: string; + readonly unit?: string; + readonly meterId?: string; + readonly meterRateFrequency?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentFeature class. + * @constructor + * An Application Insights component daily data volume cap status + * + * @member {string} [featureName] The pricing feature name. + * @member {string} [meterId] The meter id used for the feature. + * @member {string} [meterRateFrequency] The meter meter rate for the feature's + * meter. + * @member {string} [resouceId] Reserved, not used now. + * @member {boolean} [isHidden] Reserved, not used now. + * @member {array} [capabilities] A list of Application Insigths component + * feature capability. + * @member {string} [title] Desplay name of the feature. + * @member {boolean} [isMainFeature] Whether can apply addon feature on to it. + * @member {string} [supportedAddonFeatures] The add on features on main + * feature. + */ +export interface ApplicationInsightsComponentFeature { + readonly featureName?: string; + readonly meterId?: string; + readonly meterRateFrequency?: string; + readonly resouceId?: string; + readonly isHidden?: boolean; + readonly capabilities?: ApplicationInsightsComponentFeatureCapability[]; + readonly title?: string; + readonly isMainFeature?: boolean; + readonly supportedAddonFeatures?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentAvailableFeatures class. + * @constructor + * An Application Insights component available features. + * + * @member {array} [result] A list of Application Insigths component feature. + */ +export interface ApplicationInsightsComponentAvailableFeatures { + readonly result?: ApplicationInsightsComponentFeature[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions class. + * @constructor + * Static definitions of the ProactiveDetection configuration rule (same values + * for all components). + * + * @member {string} [name] The rule name + * @member {string} [displayName] The rule name as it is displayed in UI + * @member {string} [description] The rule description + * @member {string} [helpUrl] URL which displays aditional info about the + * proactive detection rule + * @member {boolean} [isHidden] A flag indicating whether the rule is hidden + * (from the UI) + * @member {boolean} [isEnabledByDefault] A flag indicating whether the rule is + * enabled by default + * @member {boolean} [isInPreview] A flag indicating whether the rule is in + * preview + * @member {boolean} [supportsEmailNotifications] A flag indicating whether + * email notifications are supported for detections for this rule + */ +export interface ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions { name?: string; - linkedReadProperties?: string[]; - linkedWriteProperties?: string[]; + displayName?: string; + description?: string; + helpUrl?: string; + isHidden?: boolean; + isEnabledByDefault?: boolean; + isInPreview?: boolean; + supportsEmailNotifications?: boolean; } /** * @class - * Initializes a new instance of the ApplicationInsightsComponentAPIKey class. + * Initializes a new instance of the ApplicationInsightsComponentProactiveDetectionConfiguration class. * @constructor - * Properties that define an API key of an Application Insights Component. + * Properties that define a ProactiveDetection configuration. * - * @member {string} [id] The unique ID of the API key inside an Applciation - * Insights component. It is auto generated when the API key is created. - * @member {string} [apiKey] The API key value. It will be only return once - * when the API Key was created. - * @member {string} [createdDate] The create date of this API key. - * @member {string} [name] The name of the API key. - * @member {array} [linkedReadProperties] The read access rights of this API - * Key. - * @member {array} [linkedWriteProperties] The write access rights of this API - * Key. + * @member {string} [name] The rule name + * @member {boolean} [enabled] A flag that indicates whether this rule is + * enabled by the user + * @member {boolean} [sendEmailsToSubscriptionOwners] A flag that indicated + * whether notifications on this rule should be sent to subscription owners + * @member {array} [customEmails] Custom email addresses for this rule + * notifications + * @member {string} [lastUpdatedTime] The last time this rule was updated + * @member {object} [ruleDefinitions] Static definitions of the + * ProactiveDetection configuration rule (same values for all components). + * @member {string} [ruleDefinitions.name] The rule name + * @member {string} [ruleDefinitions.displayName] The rule name as it is + * displayed in UI + * @member {string} [ruleDefinitions.description] The rule description + * @member {string} [ruleDefinitions.helpUrl] URL which displays aditional info + * about the proactive detection rule + * @member {boolean} [ruleDefinitions.isHidden] A flag indicating whether the + * rule is hidden (from the UI) + * @member {boolean} [ruleDefinitions.isEnabledByDefault] A flag indicating + * whether the rule is enabled by default + * @member {boolean} [ruleDefinitions.isInPreview] A flag indicating whether + * the rule is in preview + * @member {boolean} [ruleDefinitions.supportsEmailNotifications] A flag + * indicating whether email notifications are supported for detections for this + * rule */ -export interface ApplicationInsightsComponentAPIKey { +export interface ApplicationInsightsComponentProactiveDetectionConfiguration extends BaseResource { + name?: string; + enabled?: boolean; + sendEmailsToSubscriptionOwners?: boolean; + customEmails?: string[]; + lastUpdatedTime?: string; + ruleDefinitions?: ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions; +} + +/** + * @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 apiKey?: string; - createdDate?: string; + readonly name?: string; + readonly type?: string; + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the TagsResource class. + * @constructor + * A container holding only the Tags for a resource, allowing the user to + * update the tags on a WebTest instance. + * + * @member {object} [tags] Resource tags + */ +export interface TagsResource { + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponent class. + * @constructor + * An Application Insights component definition. + * + * @member {string} kind The kind of application that this component refers to, + * used to customize UI. This value is a freeform string, values should + * typically be one of the following: web, ios, other, store, java, phone. + * @member {string} [applicationId] The unique ID of your application. This + * field mirrors the 'Name' field and cannot be changed. + * @member {string} [appId] Application Insights Unique ID for your + * Application. + * @member {string} applicationType Type of application being monitored. + * Possible values include: 'web', 'other'. Default value: 'web' . + * @member {string} [flowType] Used by the Application Insights system to + * determine what kind of flow this component was created by. This is to be set + * to 'Bluefield' when creating/updating a component via the REST API. Possible + * values include: 'Bluefield'. Default value: 'Bluefield' . + * @member {string} [requestSource] Describes what tool created this + * Application Insights component. Customers using this API should set this to + * the default 'rest'. Possible values include: 'rest'. Default value: 'rest' . + * @member {string} [instrumentationKey] Application Insights Instrumentation + * key. A read-only value that applications can use to identify the destination + * for all telemetry sent to Azure Application Insights. This value will be + * supplied upon construction of each new Application Insights component. + * @member {date} [creationDate] Creation Date for the Application Insights + * component, in ISO 8601 format. + * @member {string} [tenantId] Azure Tenant Id. + * @member {string} [hockeyAppId] The unique application ID created when a new + * application is added to HockeyApp, used for communications with HockeyApp. + * @member {string} [hockeyAppToken] Token used to authenticate communications + * with between Application Insights and HockeyApp. + * @member {string} [provisioningState] Current state of this component: + * whether or not is has been provisioned within the resource group it is + * defined. Users cannot change this value but are able to read from it. Values + * will include Succeeded, Deploying, Canceled, and Failed. + * @member {number} [samplingPercentage] Percentage of the data produced by the + * application being monitored that is being sampled for Application Insights + * telemetry. + */ +export interface ApplicationInsightsComponent extends Resource { + kind: string; + readonly applicationId?: string; + readonly appId?: string; + applicationType: string; + flowType?: string; + requestSource?: string; + readonly instrumentationKey?: string; + readonly creationDate?: Date; + readonly tenantId?: string; + hockeyAppId?: string; + readonly hockeyAppToken?: string; + readonly provisioningState?: string; + samplingPercentage?: number; +} + +/** + * @class + * Initializes a new instance of the ComponentPurgeBodyFilters class. + * @constructor + * User-defined filters to return data which will be purged from the table. + * + * @member {string} [column] The column of the table over which the given query + * should run + * @member {string} [filter] A query to to run over the provided table and + * column to purge the corresponding data. + */ +export interface ComponentPurgeBodyFilters { + column?: string; + filter?: string; +} + +/** + * @class + * Initializes a new instance of the ComponentPurgeBody class. + * @constructor + * Describes the body of a purge request for an App Insights component + * + * @member {string} table Table from which to purge data. + * @member {array} filters The set of columns and filters (queries) to run over + * them to purge the resulting data. + */ +export interface ComponentPurgeBody { + table: string; + filters: ComponentPurgeBodyFilters[]; +} + +/** + * @class + * Initializes a new instance of the ComponentPurgeResponse class. + * @constructor + * Response containing operationId for a specific purge action. + * + * @member {string} operationId Id to use when querying for status for a + * particular purge operation. + */ +export interface ComponentPurgeResponse { + operationId: string; +} + +/** + * @class + * Initializes a new instance of the ComponentPurgeStatusResponse class. + * @constructor + * Response containing status for a specific purge operation. + * + * @member {string} status Status of the operation represented by the requested + * Id. Possible values include: 'Pending', 'Completed' + */ +export interface ComponentPurgeStatusResponse { + status: string; +} + +/** + * @class + * Initializes a new instance of the WorkItemConfiguration class. + * @constructor + * Work item configuration associated with an application insights resource. + * + * @member {string} [connectorId] Connector identifier where work item is + * created + * @member {string} [configDisplayName] Configuration friendly name + * @member {boolean} [isDefault] Boolean value indicating whether configuration + * is default + * @member {string} [id] Unique Id for work item + * @member {string} [configProperties] Serialized JSON object for detailed + * properties + */ +export interface WorkItemConfiguration { + connectorId?: string; + configDisplayName?: string; + isDefault?: boolean; + id?: string; + configProperties?: string; +} + +/** + * @class + * Initializes a new instance of the WorkItemCreateConfiguration class. + * @constructor + * Work item configuration creation payload + * + * @member {string} [connectorId] Unique connector id + * @member {string} [connectorDataConfiguration] Serialized JSON object for + * detaile d properties + * @member {boolean} [validateOnly] Boolean indicating validate only + * @member {string} [workItemProperties] Custom work item properties + */ +export interface WorkItemCreateConfiguration { + connectorId?: string; + connectorDataConfiguration?: string; + validateOnly?: boolean; + workItemProperties?: string; +} + +/** + * @class + * Initializes a new instance of the WorkItemConfigurationError class. + * @constructor + * Error associated with trying to get work item configuration or + * configurations + * + * @member {string} [code] Error detail code and explanation + * @member {string} [message] Error message + * @member {object} [innererror] + * @member {string} [innererror.diagnosticcontext] Provides correlation for + * request + * @member {date} [innererror.time] Request time + */ +export interface WorkItemConfigurationError { + code?: string; + message?: string; + innererror?: InnerError; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentFavorite class. + * @constructor + * Properties that define a favorite that is associated to an Application + * Insights component. + * + * @member {string} [name] The user-defined name of the favorite. + * @member {string} [config] Configuration of this particular favorite, which + * are driven by the Azure portal UX. Configuration data is a string containing + * valid JSON + * @member {string} [version] This instance's version of the data model. This + * can change as new features are added that can be marked favorite. Current + * examples include MetricsExplorer (ME) and Search. + * @member {string} [favoriteId] Internally assigned unique id of the favorite + * definition. + * @member {string} [favoriteType] Enum indicating if this favorite definition + * is owned by a specific user or is shared between all users with access to + * the Application Insights component. Possible values include: 'shared', + * 'user' + * @member {string} [sourceType] The source of the favorite definition. + * @member {string} [timeModified] Date and time in UTC of the last + * modification that was made to this favorite definition. + * @member {array} [tags] A list of 0 or more tags that are associated with + * this favorite definition + * @member {string} [category] Favorite category, as defined by the user at + * creation time. + * @member {boolean} [isGeneratedFromTemplate] Flag denoting wether or not this + * favorite was generated from a template. + * @member {string} [userId] Unique user id of the specific user that owns this + * favorite. + */ +export interface ApplicationInsightsComponentFavorite { name?: string; - linkedReadProperties?: string[]; - linkedWriteProperties?: string[]; + config?: string; + version?: string; + readonly favoriteId?: string; + favoriteType?: string; + sourceType?: string; + readonly timeModified?: string; + tags?: string[]; + category?: string; + isGeneratedFromTemplate?: boolean; + readonly userId?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentWebTestLocation class. + * @constructor + * Properties that define a web test location available to an Application + * Insights Component. + * + * @member {string} [displayName] The display name of the web test location. + * @member {string} [tag] Internally defined geographic location tag. + */ +export interface ApplicationInsightsComponentWebTestLocation { + readonly displayName?: string; + readonly tag?: string; +} + +/** + * @class + * Initializes a new instance of the WebTestGeolocation class. + * @constructor + * Geo-physical location to run a web test from. You must specify one or more + * locations for the test to run from. + * + * @member {string} [location] Location ID for the webtest to run from. + */ +export interface WebTestGeolocation { + location?: string; +} + +/** + * @class + * Initializes a new instance of the WebTestPropertiesConfiguration class. + * @constructor + * An XML configuration specification for a WebTest. + * + * @member {string} [webTest] The XML specification of a WebTest to run against + * an application. + */ +export interface WebTestPropertiesConfiguration { + webTest?: string; +} + +/** + * @class + * Initializes a new instance of the WebTest class. + * @constructor + * An Application Insights web test definition. + * + * @member {string} [kind] The kind of web test that this web test watches. + * Choices are ping and multistep. Possible values include: 'ping', + * 'multistep'. Default value: 'ping' . + * @member {string} syntheticMonitorId Unique ID of this WebTest. This is + * typically the same value as the Name field. + * @member {string} webTestName User defined name if this WebTest. + * @member {string} [description] Purpose/user defined descriptive test for + * this WebTest. + * @member {boolean} [enabled] Is the test actively being monitored. + * @member {number} [frequency] Interval in seconds between test runs for this + * WebTest. Default value is 300. Default value: 300 . + * @member {number} [timeout] Seconds until this WebTest will timeout and fail. + * Default value is 30. Default value: 30 . + * @member {string} webTestKind The kind of web test this is, valid choices are + * ping and multistep. Possible values include: 'ping', 'multistep'. Default + * value: 'ping' . + * @member {boolean} [retryEnabled] Allow for retries should this WebTest fail. + * @member {array} locations A list of where to physically run the tests from + * to give global coverage for accessibility of your application. + * @member {object} [configuration] An XML configuration specification for a + * WebTest. + * @member {string} [configuration.webTest] The XML specification of a WebTest + * to run against an application. + * @member {string} [provisioningState] Current state of this component, + * whether or not is has been provisioned within the resource group it is + * defined. Users cannot change this value but are able to read from it. Values + * will include Succeeded, Deploying, Canceled, and Failed. + */ +export interface WebTest extends Resource { + kind?: string; + syntheticMonitorId: string; + webTestName: string; + description?: string; + enabled?: boolean; + frequency?: number; + timeout?: number; + webTestKind: string; + retryEnabled?: boolean; + locations: WebTestGeolocation[]; + configuration?: WebTestPropertiesConfiguration; + readonly provisioningState?: string; } @@ -471,6 +891,16 @@ export interface OperationListResult extends Array { nextLink?: string; } +/** + * @class + * Initializes a new instance of the ApplicationInsightsComponentAPIKeyListResult class. + * @constructor + * Describes the list of API Keys of an Application Insights Component. + * + */ +export interface ApplicationInsightsComponentAPIKeyListResult extends Array { +} + /** * @class * Initializes a new instance of the ApplicationInsightsComponentListResult class. @@ -487,24 +917,25 @@ export interface ApplicationInsightsComponentListResult extends Array { - nextLink?: string; +export interface ApplicationInsightsWebTestLocationsListResult extends Array { } /** * @class - * Initializes a new instance of the ApplicationInsightsComponentAPIKeyListResult class. + * Initializes a new instance of the WebTestListResult class. * @constructor - * Describes the list of API Keys of an Application Insights Component. + * A list of 0 or more Application Insights web test definitions. * + * @member {string} [nextLink] The link to get the next part of the returned + * list of web tests, should the return set be too large for a single request. + * May be null. */ -export interface ApplicationInsightsComponentAPIKeyListResult extends Array { +export interface WebTestListResult extends Array { + nextLink?: string; } diff --git a/lib/services/applicationinsights/lib/models/index.js b/lib/services/applicationinsights/lib/models/index.js index bb0c0df8fd..2d2bfb071c 100644 --- a/lib/services/applicationinsights/lib/models/index.js +++ b/lib/services/applicationinsights/lib/models/index.js @@ -21,20 +21,39 @@ exports.CloudError = msRestAzure.CloudError; exports.ErrorResponse = require('./errorResponse'); exports.OperationDisplay = require('./operationDisplay'); exports.Operation = require('./operation'); +exports.Annotation = require('./annotation'); +exports.InnerError = require('./innerError'); +exports.AnnotationError = require('./annotationError'); +exports.APIKeyRequest = require('./aPIKeyRequest'); +exports.ApplicationInsightsComponentAPIKey = require('./applicationInsightsComponentAPIKey'); +exports.ApplicationInsightsComponentExportRequest = require('./applicationInsightsComponentExportRequest'); +exports.ApplicationInsightsComponentExportConfiguration = require('./applicationInsightsComponentExportConfiguration'); +exports.ApplicationInsightsComponentDataVolumeCap = require('./applicationInsightsComponentDataVolumeCap'); +exports.ApplicationInsightsComponentBillingFeatures = require('./applicationInsightsComponentBillingFeatures'); +exports.ApplicationInsightsComponentQuotaStatus = require('./applicationInsightsComponentQuotaStatus'); +exports.ApplicationInsightsComponentFeatureCapabilities = require('./applicationInsightsComponentFeatureCapabilities'); +exports.ApplicationInsightsComponentFeatureCapability = require('./applicationInsightsComponentFeatureCapability'); +exports.ApplicationInsightsComponentFeature = require('./applicationInsightsComponentFeature'); +exports.ApplicationInsightsComponentAvailableFeatures = require('./applicationInsightsComponentAvailableFeatures'); +exports.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions = require('./applicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions'); +exports.ApplicationInsightsComponentProactiveDetectionConfiguration = require('./applicationInsightsComponentProactiveDetectionConfiguration'); exports.Resource = require('./resource'); exports.TagsResource = require('./tagsResource'); exports.ApplicationInsightsComponent = require('./applicationInsightsComponent'); +exports.ComponentPurgeBodyFilters = require('./componentPurgeBodyFilters'); +exports.ComponentPurgeBody = require('./componentPurgeBody'); +exports.ComponentPurgeResponse = require('./componentPurgeResponse'); +exports.ComponentPurgeStatusResponse = require('./componentPurgeStatusResponse'); +exports.WorkItemConfiguration = require('./workItemConfiguration'); +exports.WorkItemCreateConfiguration = require('./workItemCreateConfiguration'); +exports.WorkItemConfigurationError = require('./workItemConfigurationError'); +exports.ApplicationInsightsComponentFavorite = require('./applicationInsightsComponentFavorite'); +exports.ApplicationInsightsComponentWebTestLocation = require('./applicationInsightsComponentWebTestLocation'); exports.WebTestGeolocation = require('./webTestGeolocation'); exports.WebTestPropertiesConfiguration = require('./webTestPropertiesConfiguration'); exports.WebTest = require('./webTest'); -exports.ApplicationInsightsComponentExportRequest = require('./applicationInsightsComponentExportRequest'); -exports.ApplicationInsightsComponentExportConfiguration = require('./applicationInsightsComponentExportConfiguration'); -exports.ApplicationInsightsComponentDataVolumeCap = require('./applicationInsightsComponentDataVolumeCap'); -exports.ApplicationInsightsComponentBillingFeatures = require('./applicationInsightsComponentBillingFeatures'); -exports.ApplicationInsightsComponentQuotaStatus = require('./applicationInsightsComponentQuotaStatus'); -exports.APIKeyRequest = require('./aPIKeyRequest'); -exports.ApplicationInsightsComponentAPIKey = require('./applicationInsightsComponentAPIKey'); exports.OperationListResult = require('./operationListResult'); +exports.ApplicationInsightsComponentAPIKeyListResult = require('./applicationInsightsComponentAPIKeyListResult'); exports.ApplicationInsightsComponentListResult = require('./applicationInsightsComponentListResult'); +exports.ApplicationInsightsWebTestLocationsListResult = require('./applicationInsightsWebTestLocationsListResult'); exports.WebTestListResult = require('./webTestListResult'); -exports.ApplicationInsightsComponentAPIKeyListResult = require('./applicationInsightsComponentAPIKeyListResult'); diff --git a/lib/services/applicationinsights/lib/models/innerError.js b/lib/services/applicationinsights/lib/models/innerError.js new file mode 100644 index 0000000000..171a217f5e --- /dev/null +++ b/lib/services/applicationinsights/lib/models/innerError.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'; + +/** + * Inner error + * + */ +class InnerError { + /** + * Create a InnerError. + * @member {string} [diagnosticcontext] Provides correlation for request + * @member {date} [time] Request time + */ + constructor() { + } + + /** + * Defines the metadata of InnerError + * + * @returns {object} metadata of InnerError + * + */ + mapper() { + return { + required: false, + serializedName: 'InnerError', + type: { + name: 'Composite', + className: 'InnerError', + modelProperties: { + diagnosticcontext: { + required: false, + serializedName: 'diagnosticcontext', + type: { + name: 'String' + } + }, + time: { + required: false, + serializedName: 'time', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = InnerError; diff --git a/lib/services/applicationinsights/lib/models/workItemConfiguration.js b/lib/services/applicationinsights/lib/models/workItemConfiguration.js new file mode 100644 index 0000000000..f5a7ec8a9e --- /dev/null +++ b/lib/services/applicationinsights/lib/models/workItemConfiguration.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'; + +/** + * Work item configuration associated with an application insights resource. + * + */ +class WorkItemConfiguration { + /** + * Create a WorkItemConfiguration. + * @member {string} [connectorId] Connector identifier where work item is + * created + * @member {string} [configDisplayName] Configuration friendly name + * @member {boolean} [isDefault] Boolean value indicating whether + * configuration is default + * @member {string} [id] Unique Id for work item + * @member {string} [configProperties] Serialized JSON object for detailed + * properties + */ + constructor() { + } + + /** + * Defines the metadata of WorkItemConfiguration + * + * @returns {object} metadata of WorkItemConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'WorkItemConfiguration', + type: { + name: 'Composite', + className: 'WorkItemConfiguration', + modelProperties: { + connectorId: { + required: false, + serializedName: 'ConnectorId', + type: { + name: 'String' + } + }, + configDisplayName: { + required: false, + serializedName: 'ConfigDisplayName', + type: { + name: 'String' + } + }, + isDefault: { + required: false, + serializedName: 'IsDefault', + type: { + name: 'Boolean' + } + }, + id: { + required: false, + serializedName: 'Id', + type: { + name: 'String' + } + }, + configProperties: { + required: false, + serializedName: 'ConfigProperties', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WorkItemConfiguration; diff --git a/lib/services/applicationinsights/lib/models/workItemConfigurationError.js b/lib/services/applicationinsights/lib/models/workItemConfigurationError.js new file mode 100644 index 0000000000..562531bf21 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/workItemConfigurationError.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'); + +/** + * Error associated with trying to get work item configuration or + * configurations + * + */ +class WorkItemConfigurationError { + /** + * Create a WorkItemConfigurationError. + * @member {string} [code] Error detail code and explanation + * @member {string} [message] Error message + * @member {object} [innererror] + * @member {string} [innererror.diagnosticcontext] Provides correlation for + * request + * @member {date} [innererror.time] Request time + */ + constructor() { + } + + /** + * Defines the metadata of WorkItemConfigurationError + * + * @returns {object} metadata of WorkItemConfigurationError + * + */ + mapper() { + return { + required: false, + serializedName: 'WorkItemConfigurationError', + type: { + name: 'Composite', + className: 'WorkItemConfigurationError', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + innererror: { + required: false, + serializedName: 'innererror', + type: { + name: 'Composite', + className: 'InnerError' + } + } + } + } + }; + } +} + +module.exports = WorkItemConfigurationError; diff --git a/lib/services/applicationinsights/lib/models/workItemCreateConfiguration.js b/lib/services/applicationinsights/lib/models/workItemCreateConfiguration.js new file mode 100644 index 0000000000..f15933feb7 --- /dev/null +++ b/lib/services/applicationinsights/lib/models/workItemCreateConfiguration.js @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Work item configuration creation payload + * + */ +class WorkItemCreateConfiguration { + /** + * Create a WorkItemCreateConfiguration. + * @member {string} [connectorId] Unique connector id + * @member {string} [connectorDataConfiguration] Serialized JSON object for + * detaile d properties + * @member {boolean} [validateOnly] Boolean indicating validate only + * @member {string} [workItemProperties] Custom work item properties + */ + constructor() { + } + + /** + * Defines the metadata of WorkItemCreateConfiguration + * + * @returns {object} metadata of WorkItemCreateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'WorkItemCreateConfiguration', + type: { + name: 'Composite', + className: 'WorkItemCreateConfiguration', + modelProperties: { + connectorId: { + required: false, + serializedName: 'ConnectorId', + type: { + name: 'String' + } + }, + connectorDataConfiguration: { + required: false, + serializedName: 'ConnectorDataConfiguration', + type: { + name: 'String' + } + }, + validateOnly: { + required: false, + serializedName: 'ValidateOnly', + type: { + name: 'Boolean' + } + }, + workItemProperties: { + required: false, + serializedName: 'WorkItemProperties', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WorkItemCreateConfiguration; diff --git a/lib/services/applicationinsights/lib/operations/aPIKeys.js b/lib/services/applicationinsights/lib/operations/aPIKeys.js index 25d380783a..580a24f80b 100644 --- a/lib/services/applicationinsights/lib/operations/aPIKeys.js +++ b/lib/services/applicationinsights/lib/operations/aPIKeys.js @@ -75,7 +75,7 @@ function _list(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ApiKeys'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -236,7 +236,7 @@ function _create(resourceGroupName, resourceName, aPIKeyProperties, options, cal // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/ApiKeys'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -403,7 +403,7 @@ function _deleteMethod(resourceGroupName, resourceName, keyId, options, callback // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/APIKeys/{keyId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -557,7 +557,7 @@ function _get(resourceGroupName, resourceName, keyId, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/APIKeys/{keyId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); diff --git a/lib/services/applicationinsights/lib/operations/annotations.js b/lib/services/applicationinsights/lib/operations/annotations.js new file mode 100644 index 0000000000..9cbbf32d6a --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/annotations.js @@ -0,0 +1,1132 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 list of annotations for a component for given time range + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} start The start time to query from for annotations, cannot + * be older than 90 days from current date. + * + * @param {string} end The end time to query for annotations. + * + * @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. + * + * {array} [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 _list(resourceGroupName, resourceName, start, end, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (start === null || start === undefined || typeof start.valueOf() !== 'string') { + throw new Error('start cannot be null or undefined and it must be of type string.'); + } + if (end === null || end === undefined || typeof end.valueOf() !== 'string') { + throw new Error('end 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/components/{resourceName}/Annotations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('start=' + encodeURIComponent(start)); + queryParameters.push('end=' + encodeURIComponent(end)); + 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['AnnotationError']().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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AnnotationElementType', + type: { + name: 'Composite', + className: 'Annotation' + } + } + } + }; + 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 an Annotation of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} annotationProperties Properties that need to be specified to + * create an annotation of a Application Insights component. + * + * @param {string} [annotationProperties.annotationName] Name of annotation + * + * @param {string} [annotationProperties.category] Category of annotation, free + * form + * + * @param {date} [annotationProperties.eventTime] Time when event occurred + * + * @param {string} [annotationProperties.id] Unique Id for annotation + * + * @param {string} [annotationProperties.properties] Serialized JSON object for + * detailed properties + * + * @param {string} [annotationProperties.relatedAnnotation] Related parent + * annotation if any + * + * @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. + * + * {array} [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 _create(resourceGroupName, resourceName, annotationProperties, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (annotationProperties === null || annotationProperties === undefined) { + throw new Error('annotationProperties 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/components/{resourceName}/Annotations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (annotationProperties !== null && annotationProperties !== undefined) { + let requestModelMapper = new client.models['Annotation']().mapper(); + requestModel = client.serialize(requestModelMapper, annotationProperties, 'annotationProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(annotationProperties, 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['AnnotationError']().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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AnnotationElementType', + type: { + name: 'Composite', + className: 'Annotation' + } + } + } + }; + 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 Annotation of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * + * @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. + * + * {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, resourceName, annotationId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (annotationId === null || annotationId === undefined || typeof annotationId.valueOf() !== 'string') { + throw new Error('annotationId 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/components/{resourceName}/Annotations/{annotationId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{annotationId}', encodeURIComponent(annotationId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Object' + } + }; + 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 the annotation for given id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * + * @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. + * + * {array} [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 _get(resourceGroupName, resourceName, annotationId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (annotationId === null || annotationId === undefined || typeof annotationId.valueOf() !== 'string') { + throw new Error('annotationId 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/components/{resourceName}/Annotations/{annotationId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{annotationId}', encodeURIComponent(annotationId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['AnnotationError']().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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AnnotationElementType', + type: { + name: 'Composite', + className: 'Annotation' + } + } + } + }; + 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 Annotations. */ +class Annotations { + /** + * Create a Annotations. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._get = _get; + } + + /** + * Gets the list of annotations for a component for given time range + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} start The start time to query from for annotations, cannot + * be older than 90 days from current date. + * + * @param {string} end The end time to query for annotations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, start, end, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, resourceName, start, end, 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 list of annotations for a component for given time range + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} start The start time to query from for annotations, cannot + * be older than 90 days from current date. + * + * @param {string} end The end time to query for annotations. + * + * @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 {Array} - 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. + * + * {array} [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. + */ + list(resourceGroupName, resourceName, start, end, 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, resourceName, start, end, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, resourceName, start, end, options, optionalCallback); + } + } + + /** + * Create an Annotation of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} annotationProperties Properties that need to be specified to + * create an annotation of a Application Insights component. + * + * @param {string} [annotationProperties.annotationName] Name of annotation + * + * @param {string} [annotationProperties.category] Category of annotation, free + * form + * + * @param {date} [annotationProperties.eventTime] Time when event occurred + * + * @param {string} [annotationProperties.id] Unique Id for annotation + * + * @param {string} [annotationProperties.properties] Serialized JSON object for + * detailed properties + * + * @param {string} [annotationProperties.relatedAnnotation] Related parent + * annotation if any + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName, resourceName, annotationProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, resourceName, annotationProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create an Annotation of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} annotationProperties Properties that need to be specified to + * create an annotation of a Application Insights component. + * + * @param {string} [annotationProperties.annotationName] Name of annotation + * + * @param {string} [annotationProperties.category] Category of annotation, free + * form + * + * @param {date} [annotationProperties.eventTime] Time when event occurred + * + * @param {string} [annotationProperties.id] Unique Id for annotation + * + * @param {string} [annotationProperties.properties] Serialized JSON object for + * detailed properties + * + * @param {string} [annotationProperties.relatedAnnotation] Related parent + * annotation if any + * + * @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 {Array} - 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. + * + * {array} [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. + */ + create(resourceGroupName, resourceName, annotationProperties, 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._create(resourceGroupName, resourceName, annotationProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, resourceName, annotationProperties, options, optionalCallback); + } + } + + /** + * Delete an Annotation of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, annotationId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, resourceName, annotationId, 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 Annotation of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * + * @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 {Object} - 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. + * + * {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, resourceName, annotationId, 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, resourceName, annotationId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, resourceName, annotationId, options, optionalCallback); + } + } + + /** + * Get the annotation for given id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, annotationId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, annotationId, 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 annotation for given id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * + * @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 {Array} - 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. + * + * {array} [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. + */ + get(resourceGroupName, resourceName, annotationId, 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, resourceName, annotationId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, resourceName, annotationId, options, optionalCallback); + } + } + +} + +module.exports = Annotations; diff --git a/lib/services/applicationinsights/lib/operations/componentAvailableFeatures.js b/lib/services/applicationinsights/lib/operations/componentAvailableFeatures.js new file mode 100644 index 0000000000..4c09dca770 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/componentAvailableFeatures.js @@ -0,0 +1,268 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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; + +/** + * Returns all available features of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 + * ApplicationInsightsComponentAvailableFeatures} for more + * information. + * + * {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, resourceName, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName 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/components/{resourceName}/getavailablebillingfeatures'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ApplicationInsightsComponentAvailableFeatures']().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 ComponentAvailableFeatures. */ +class ComponentAvailableFeatures { + /** + * Create a ComponentAvailableFeatures. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Returns all available features of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns all available features of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponentAvailableFeatures} - 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 + * ApplicationInsightsComponentAvailableFeatures} for more + * information. + * + * {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, resourceName, 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, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, resourceName, options, optionalCallback); + } + } + +} + +module.exports = ComponentAvailableFeatures; diff --git a/lib/services/applicationinsights/lib/operations/componentCurrentBillingFeatures.js b/lib/services/applicationinsights/lib/operations/componentCurrentBillingFeatures.js index 705b6084d1..3a51f84308 100644 --- a/lib/services/applicationinsights/lib/operations/componentCurrentBillingFeatures.js +++ b/lib/services/applicationinsights/lib/operations/componentCurrentBillingFeatures.js @@ -74,7 +74,7 @@ function _get(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/currentbillingfeatures'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -248,7 +248,7 @@ function _update(resourceGroupName, resourceName, billingFeaturesProperties, opt // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/currentbillingfeatures'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); diff --git a/lib/services/applicationinsights/lib/operations/componentFeatureCapabilities.js b/lib/services/applicationinsights/lib/operations/componentFeatureCapabilities.js new file mode 100644 index 0000000000..2b3873b153 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/componentFeatureCapabilities.js @@ -0,0 +1,268 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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; + +/** + * Returns feature capabilites of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 + * ApplicationInsightsComponentFeatureCapabilities} for + * more information. + * + * {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, resourceName, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName 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/components/{resourceName}/featurecapabilities'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ApplicationInsightsComponentFeatureCapabilities']().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 ComponentFeatureCapabilities. */ +class ComponentFeatureCapabilities { + /** + * Create a ComponentFeatureCapabilities. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Returns feature capabilites of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns feature capabilites of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponentFeatureCapabilities} - 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 + * ApplicationInsightsComponentFeatureCapabilities} for + * more information. + * + * {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, resourceName, 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, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, resourceName, options, optionalCallback); + } + } + +} + +module.exports = ComponentFeatureCapabilities; diff --git a/lib/services/applicationinsights/lib/operations/componentQuotaStatus.js b/lib/services/applicationinsights/lib/operations/componentQuotaStatus.js index 0bd9a23ef9..0eba541676 100644 --- a/lib/services/applicationinsights/lib/operations/componentQuotaStatus.js +++ b/lib/services/applicationinsights/lib/operations/componentQuotaStatus.js @@ -75,7 +75,7 @@ function _get(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/quotastatus'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); diff --git a/lib/services/applicationinsights/lib/operations/components.js b/lib/services/applicationinsights/lib/operations/components.js index cf6b71c358..104b7fdedb 100644 --- a/lib/services/applicationinsights/lib/operations/components.js +++ b/lib/services/applicationinsights/lib/operations/components.js @@ -63,7 +63,7 @@ function _list(options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/microsoft.insights/components'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Insights/components'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); @@ -202,7 +202,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -346,7 +346,7 @@ function _deleteMethod(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -476,7 +476,7 @@ function _get(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -660,7 +660,7 @@ function _createOrUpdate(resourceGroupName, resourceName, insightProperties, opt // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -830,7 +830,7 @@ function _updateTags(resourceGroupName, resourceName, componentTags, options, ca // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -931,6 +931,334 @@ function _updateTags(resourceGroupName, resourceName, componentTags, options, ca }); } +/** + * Purges data in an Application Insights component by a set of user-defined + * filters. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} body Describes the body of a request to purge data in a + * single table of an Application Insights component + * + * @param {string} body.table Table from which to purge data. + * + * @param {array} body.filters The set of columns and filters (queries) to run + * over them to purge the resulting data. + * + * @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 ComponentPurgeResponse} for more + * information. + * + * {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 _purge(resourceGroupName, resourceName, body, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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/components/{resourceName}/purge'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['ComponentPurgeBody']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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 !== 202) { + 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 === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ComponentPurgeResponse']().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 status of a previously submitted purge using the id returned from + * the original purge request. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} purgeId In a purge status request, this is the Id of the + * operation the status of which is returned. + * + * @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 ComponentPurgeStatusResponse} for more + * information. + * + * {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 _getPurgeStatus(resourceGroupName, resourceName, purgeId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (purgeId === null || purgeId === undefined || typeof purgeId.valueOf() !== 'string') { + throw new Error('purgeId 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/components/{resourceName}/operations/{purgeId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{purgeId}', encodeURIComponent(purgeId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ComponentPurgeStatusResponse']().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 all Application Insights components within a subscription. * @@ -1201,6 +1529,8 @@ class Components { this._get = _get; this._createOrUpdate = _createOrUpdate; this._updateTags = _updateTags; + this._purge = _purge; + this._getPurgeStatus = _getPurgeStatus; this._listNext = _listNext; this._listByResourceGroupNext = _listByResourceGroupNext; } @@ -1801,6 +2131,210 @@ class Components { } } + /** + * Purges data in an Application Insights component by a set of user-defined + * filters. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} body Describes the body of a request to purge data in a + * single table of an Application Insights component + * + * @param {string} body.table Table from which to purge data. + * + * @param {array} body.filters The set of columns and filters (queries) to run + * over them to purge the resulting data. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + purgeWithHttpOperationResponse(resourceGroupName, resourceName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._purge(resourceGroupName, resourceName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Purges data in an Application Insights component by a set of user-defined + * filters. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} body Describes the body of a request to purge data in a + * single table of an Application Insights component + * + * @param {string} body.table Table from which to purge data. + * + * @param {array} body.filters The set of columns and filters (queries) to run + * over them to purge the resulting data. + * + * @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 {ComponentPurgeResponse} - 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 ComponentPurgeResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + purge(resourceGroupName, resourceName, body, 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._purge(resourceGroupName, resourceName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._purge(resourceGroupName, resourceName, body, options, optionalCallback); + } + } + + /** + * Gets the status of a previously submitted purge using the id returned from + * the original purge request. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} purgeId In a purge status request, this is the Id of the + * operation the status of which is returned. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + getPurgeStatusWithHttpOperationResponse(resourceGroupName, resourceName, purgeId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getPurgeStatus(resourceGroupName, resourceName, purgeId, 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 status of a previously submitted purge using the id returned from + * the original purge request. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} purgeId In a purge status request, this is the Id of the + * operation the status of which is returned. + * + * @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 {ComponentPurgeStatusResponse} - 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 ComponentPurgeStatusResponse} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getPurgeStatus(resourceGroupName, resourceName, purgeId, 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._getPurgeStatus(resourceGroupName, resourceName, purgeId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getPurgeStatus(resourceGroupName, resourceName, purgeId, options, optionalCallback); + } + } + /** * Gets a list of all Application Insights components within a subscription. * diff --git a/lib/services/applicationinsights/lib/operations/exportConfigurations.js b/lib/services/applicationinsights/lib/operations/exportConfigurations.js index 51ad9985e5..a37dc460ef 100644 --- a/lib/services/applicationinsights/lib/operations/exportConfigurations.js +++ b/lib/services/applicationinsights/lib/operations/exportConfigurations.js @@ -73,7 +73,7 @@ function _list(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -267,7 +267,7 @@ function _create(resourceGroupName, resourceName, exportProperties, options, cal // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -450,7 +450,7 @@ function _deleteMethod(resourceGroupName, resourceName, exportId, options, callb // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration/{exportId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -605,7 +605,7 @@ function _get(resourceGroupName, resourceName, exportId, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration/{exportId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); @@ -793,7 +793,7 @@ function _update(resourceGroupName, resourceName, exportId, exportProperties, op // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/exportconfiguration/{exportId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); diff --git a/lib/services/applicationinsights/lib/operations/favorite.js b/lib/services/applicationinsights/lib/operations/favorite.js new file mode 100644 index 0000000000..d5e8163654 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/favorite.js @@ -0,0 +1,1234 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 a single favorite by its FavoriteId, defined within an Application + * Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @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 ApplicationInsightsComponentFavorite} for + * more information. + * + * {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, resourceName, favoriteId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (favoriteId === null || favoriteId === undefined || typeof favoriteId.valueOf() !== 'string') { + throw new Error('favoriteId 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/components/{resourceName}/favorites/{favoriteId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{favoriteId}', encodeURIComponent(favoriteId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ApplicationInsightsComponentFavorite']().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); + }); +} + +/** + * Adds a new favorites to an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * create a new favorite and add it to an Application Insights component. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * + * @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 ApplicationInsightsComponentFavorite} for + * more information. + * + * {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 _add(resourceGroupName, resourceName, favoriteId, favoriteProperties, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (favoriteId === null || favoriteId === undefined || typeof favoriteId.valueOf() !== 'string') { + throw new Error('favoriteId cannot be null or undefined and it must be of type string.'); + } + if (favoriteProperties === null || favoriteProperties === undefined) { + throw new Error('favoriteProperties 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/components/{resourceName}/favorites/{favoriteId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{favoriteId}', encodeURIComponent(favoriteId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (favoriteProperties !== null && favoriteProperties !== undefined) { + let requestModelMapper = new client.models['ApplicationInsightsComponentFavorite']().mapper(); + requestModel = client.serialize(requestModelMapper, favoriteProperties, 'favoriteProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(favoriteProperties, 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['ApplicationInsightsComponentFavorite']().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 a favorite that has already been added to an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * update the existing favorite. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * + * @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 ApplicationInsightsComponentFavorite} for + * more information. + * + * {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, resourceName, favoriteId, favoriteProperties, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (favoriteId === null || favoriteId === undefined || typeof favoriteId.valueOf() !== 'string') { + throw new Error('favoriteId cannot be null or undefined and it must be of type string.'); + } + if (favoriteProperties === null || favoriteProperties === undefined) { + throw new Error('favoriteProperties 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/components/{resourceName}/favorites/{favoriteId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{favoriteId}', encodeURIComponent(favoriteId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (favoriteProperties !== null && favoriteProperties !== undefined) { + let requestModelMapper = new client.models['ApplicationInsightsComponentFavorite']().mapper(); + requestModel = client.serialize(requestModelMapper, favoriteProperties, 'favoriteProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(favoriteProperties, 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['ApplicationInsightsComponentFavorite']().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); + }); +} + +/** + * Remove a favorite that is associated to an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @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, resourceName, favoriteId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (favoriteId === null || favoriteId === undefined || typeof favoriteId.valueOf() !== 'string') { + throw new Error('favoriteId 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/components/{resourceName}/favorites/{favoriteId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{favoriteId}', encodeURIComponent(favoriteId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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); + }); +} + +/** Class representing a Favorite. */ +class Favorite { + /** + * Create a Favorite. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._add = _add; + this._update = _update; + this._deleteMethod = _deleteMethod; + } + + /** + * Get a single favorite by its FavoriteId, defined within an Application + * Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, favoriteId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, favoriteId, 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 single favorite by its FavoriteId, defined within an Application + * Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @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 {ApplicationInsightsComponentFavorite} - 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 ApplicationInsightsComponentFavorite} for + * more information. + * + * {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, resourceName, favoriteId, 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, resourceName, favoriteId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, resourceName, favoriteId, options, optionalCallback); + } + } + + /** + * Adds a new favorites to an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * create a new favorite and add it to an Application Insights component. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + addWithHttpOperationResponse(resourceGroupName, resourceName, favoriteId, favoriteProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._add(resourceGroupName, resourceName, favoriteId, favoriteProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Adds a new favorites to an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * create a new favorite and add it to an Application Insights component. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * + * @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 {ApplicationInsightsComponentFavorite} - 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 ApplicationInsightsComponentFavorite} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + add(resourceGroupName, resourceName, favoriteId, favoriteProperties, 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._add(resourceGroupName, resourceName, favoriteId, favoriteProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._add(resourceGroupName, resourceName, favoriteId, favoriteProperties, options, optionalCallback); + } + } + + /** + * Updates a favorite that has already been added to an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * update the existing favorite. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, favoriteId, favoriteProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, resourceName, favoriteId, favoriteProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a favorite that has already been added to an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * update the existing favorite. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * + * @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 {ApplicationInsightsComponentFavorite} - 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 ApplicationInsightsComponentFavorite} for + * more information. + * + * {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, resourceName, favoriteId, favoriteProperties, 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, resourceName, favoriteId, favoriteProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, resourceName, favoriteId, favoriteProperties, options, optionalCallback); + } + } + + /** + * Remove a favorite that is associated to an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, favoriteId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, resourceName, favoriteId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Remove a favorite that is associated to an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @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, resourceName, favoriteId, 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, resourceName, favoriteId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, resourceName, favoriteId, options, optionalCallback); + } + } + +} + +module.exports = Favorite; diff --git a/lib/services/applicationinsights/lib/operations/favorites.js b/lib/services/applicationinsights/lib/operations/favorites.js new file mode 100644 index 0000000000..b72dd84a07 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/favorites.js @@ -0,0 +1,356 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 a list of favorites defined within an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.favoriteType] The type of favorite. Value can be + * either shared or user. Possible values include: 'shared', 'user' + * + * @param {string} [options.sourceType] Source type of favorite to return. When + * left out, the source type defaults to 'other' (not present in this enum). + * Possible values include: 'retention', 'notebook', 'sessions', 'events', + * 'userflows', 'funnel', 'impact', 'segmentation' + * + * @param {boolean} [options.canFetchContent] Flag indicating whether or not to + * return the full content for each applicable favorite. If false, only return + * summary content for favorites. + * + * @param {array} [options.tags] Tags that must be present on each favorite + * returned. + * + * @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. + * + * {array} [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 _list(resourceGroupName, resourceName, 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 favoriteType = (options && options.favoriteType !== undefined) ? options.favoriteType : 'shared'; + let sourceType = (options && options.sourceType !== undefined) ? options.sourceType : undefined; + let canFetchContent = (options && options.canFetchContent !== undefined) ? options.canFetchContent : undefined; + let tags = (options && options.tags !== undefined) ? options.tags : undefined; + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (favoriteType) { + let allowedValues = [ 'shared', 'user' ]; + if (!allowedValues.some( function(item) { return item === favoriteType; })) { + throw new Error(favoriteType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + if (sourceType !== null && sourceType !== undefined && typeof sourceType.valueOf() !== 'string') { + throw new Error('sourceType must be of type string.'); + } + if (canFetchContent !== null && canFetchContent !== undefined && typeof canFetchContent !== 'boolean') { + throw new Error('canFetchContent must be of type boolean.'); + } + if (Array.isArray(tags)) { + for (let i = 0; i < tags.length; i++) { + if (tags[i] !== null && tags[i] !== undefined && typeof tags[i].valueOf() !== 'string') { + throw new Error('tags[i] 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/components/{resourceName}/favorites'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (favoriteType !== null && favoriteType !== undefined) { + queryParameters.push('favoriteType=' + encodeURIComponent(favoriteType)); + } + if (sourceType !== null && sourceType !== undefined) { + queryParameters.push('sourceType=' + encodeURIComponent(sourceType)); + } + if (canFetchContent !== null && canFetchContent !== undefined) { + queryParameters.push('canFetchContent=' + encodeURIComponent(canFetchContent.toString())); + } + if (tags !== null && tags !== undefined) { + queryParameters.push('tags=' + encodeURIComponent(tags.join(','))); + } + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationInsightsComponentFavoriteElementType', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentFavorite' + } + } + } + }; + 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 Favorites. */ +class Favorites { + /** + * Create a Favorites. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Gets a list of favorites defined within an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.favoriteType] The type of favorite. Value can be + * either shared or user. Possible values include: 'shared', 'user' + * + * @param {string} [options.sourceType] Source type of favorite to return. When + * left out, the source type defaults to 'other' (not present in this enum). + * Possible values include: 'retention', 'notebook', 'sessions', 'events', + * 'userflows', 'funnel', 'impact', 'segmentation' + * + * @param {boolean} [options.canFetchContent] Flag indicating whether or not to + * return the full content for each applicable favorite. If false, only return + * summary content for favorites. + * + * @param {array} [options.tags] Tags that must be present on each favorite + * returned. + * + * @param {object} [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, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, resourceName, 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 favorites defined within an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.favoriteType] The type of favorite. Value can be + * either shared or user. Possible values include: 'shared', 'user' + * + * @param {string} [options.sourceType] Source type of favorite to return. When + * left out, the source type defaults to 'other' (not present in this enum). + * Possible values include: 'retention', 'notebook', 'sessions', 'events', + * 'userflows', 'funnel', 'impact', 'segmentation' + * + * @param {boolean} [options.canFetchContent] Flag indicating whether or not to + * return the full content for each applicable favorite. If false, only return + * summary content for favorites. + * + * @param {array} [options.tags] Tags that must be present on each favorite + * returned. + * + * @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 {Array} - 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. + * + * {array} [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. + */ + list(resourceGroupName, resourceName, 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, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, resourceName, options, optionalCallback); + } + } + +} + +module.exports = Favorites; diff --git a/lib/services/applicationinsights/lib/operations/index.d.ts b/lib/services/applicationinsights/lib/operations/index.d.ts index 20378de7ab..8b559094ee 100644 --- a/lib/services/applicationinsights/lib/operations/index.d.ts +++ b/lib/services/applicationinsights/lib/operations/index.d.ts @@ -131,15 +131,25 @@ export interface Operations { /** * @class - * Components + * Annotations * __NOTE__: An instance of this class is automatically created for an * instance of the ApplicationInsightsManagementClient. */ -export interface Components { +export interface Annotations { /** - * Gets a list of all Application Insights components within a subscription. + * Gets the list of annotations for a component for given time range + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} start The start time to query from for annotations, cannot + * be older than 90 days from current date. + * + * @param {string} end The end time to query for annotations. * * @param {object} [options] Optional Parameters. * @@ -148,14 +158,24 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, start: string, end: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of all Application Insights components within a subscription. + * Gets the list of annotations for a component for given time range + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} start The start time to query from for annotations, cannot + * be older than 90 days from current date. + * + * @param {string} end The end time to query for annotations. * * @param {object} [options] Optional Parameters. * @@ -169,7 +189,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentListResult} - The deserialized result object. + * @resolve {Array} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -177,24 +197,43 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentListResult} for - * more information. + * {Array} [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. */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, start: string, end: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, start: string, end: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, start: string, end: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of Application Insights components within a resource group. + * Create an Annotation of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} annotationProperties Properties that need to be specified to + * create an annotation of a Application Insights component. + * + * @param {string} [annotationProperties.annotationName] Name of annotation + * + * @param {string} [annotationProperties.category] Category of annotation, free + * form + * + * @param {date} [annotationProperties.eventTime] Time when event occurred + * + * @param {string} [annotationProperties.id] Unique Id for annotation + * + * @param {string} [annotationProperties.properties] Serialized JSON object for + * detailed properties + * + * @param {string} [annotationProperties.relatedAnnotation] Related parent + * annotation if any + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -202,17 +241,38 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, resourceName: string, annotationProperties: models.Annotation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of Application Insights components within a resource group. + * Create an Annotation of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} annotationProperties Properties that need to be specified to + * create an annotation of a Application Insights component. + * + * @param {string} [annotationProperties.annotationName] Name of annotation + * + * @param {string} [annotationProperties.category] Category of annotation, free + * form + * + * @param {date} [annotationProperties.eventTime] Time when event occurred + * + * @param {string} [annotationProperties.id] Unique Id for annotation + * + * @param {string} [annotationProperties.properties] Serialized JSON object for + * detailed properties + * + * @param {string} [annotationProperties.relatedAnnotation] Related parent + * annotation if any + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -225,7 +285,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentListResult} - The deserialized result object. + * @resolve {Array} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -233,27 +293,28 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentListResult} for - * more information. + * {Array} [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. */ - 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; + create(resourceGroupName: string, resourceName: string, annotationProperties: models.Annotation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, resourceName: string, annotationProperties: models.Annotation, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, annotationProperties: models.Annotation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes an Application Insights component. + * Delete an Annotation of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -261,20 +322,23 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, annotationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes an Application Insights component. + * Delete an Annotation of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -287,7 +351,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {Object} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -295,25 +359,28 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {Object} [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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, annotationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, annotationId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, annotationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns an Application Insights component. + * Get the annotation for given id. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -321,20 +388,23 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, annotationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns an Application Insights component. + * Get the annotation for given id. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {string} annotationId The unique annotation ID. This is unique within + * a Application Insights component. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -347,7 +417,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponent} - The deserialized result object. + * @resolve {Array} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -355,61 +425,34 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponent} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponent} for more - * information. + * {Array} [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. */ - get(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, annotationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, annotationId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, annotationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * APIKeys + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface APIKeys { /** - * Creates (or updates) an Application Insights component. Note: You cannot - * specify a different value for InstrumentationKey nor AppId in the Put - * operation. + * Gets a list of API keys of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} insightProperties Properties that need to be specified to - * create an Application Insights component. - * - * @param {string} insightProperties.kind The kind of application that this - * component refers to, used to customize UI. This value is a freeform string, - * values should typically be one of the following: web, ios, other, store, - * java, phone. - * - * @param {string} insightProperties.applicationType Type of application being - * monitored. Possible values include: 'web', 'other' - * - * @param {string} [insightProperties.flowType] Used by the Application - * Insights system to determine what kind of flow this component was created - * by. This is to be set to 'Bluefield' when creating/updating a component via - * the REST API. Possible values include: 'Bluefield' - * - * @param {string} [insightProperties.requestSource] Describes what tool - * created this Application Insights component. Customers using this API should - * set this to the default 'rest'. Possible values include: 'rest' - * - * @param {string} [insightProperties.hockeyAppId] The unique application ID - * created when a new application is added to HockeyApp, used for - * communications with HockeyApp. - * - * @param {number} [insightProperties.samplingPercentage] Percentage of the - * data produced by the application being monitored that is being sampled for - * Application Insights telemetry. - * - * @param {string} insightProperties.location Resource location - * - * @param {object} [insightProperties.tags] Resource tags - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -417,54 +460,20 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, insightProperties: models.ApplicationInsightsComponent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates (or updates) an Application Insights component. Note: You cannot - * specify a different value for InstrumentationKey nor AppId in the Put - * operation. + * Gets a list of API keys of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} insightProperties Properties that need to be specified to - * create an Application Insights component. - * - * @param {string} insightProperties.kind The kind of application that this - * component refers to, used to customize UI. This value is a freeform string, - * values should typically be one of the following: web, ios, other, store, - * java, phone. - * - * @param {string} insightProperties.applicationType Type of application being - * monitored. Possible values include: 'web', 'other' - * - * @param {string} [insightProperties.flowType] Used by the Application - * Insights system to determine what kind of flow this component was created - * by. This is to be set to 'Bluefield' when creating/updating a component via - * the REST API. Possible values include: 'Bluefield' - * - * @param {string} [insightProperties.requestSource] Describes what tool - * created this Application Insights component. Customers using this API should - * set this to the default 'rest'. Possible values include: 'rest' - * - * @param {string} [insightProperties.hockeyAppId] The unique application ID - * created when a new application is added to HockeyApp, used for - * communications with HockeyApp. - * - * @param {number} [insightProperties.samplingPercentage] Percentage of the - * data produced by the application being monitored that is being sampled for - * Application Insights telemetry. - * - * @param {string} insightProperties.location Resource location - * - * @param {object} [insightProperties.tags] Resource tags - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -477,7 +486,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponent} - The deserialized result object. + * @resolve {ApplicationInsightsComponentAPIKeyListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -485,32 +494,38 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponent} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponent} for more + * {ApplicationInsightsComponentAPIKeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentAPIKeyListResult} 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, resourceName: string, insightProperties: models.ApplicationInsightsComponent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, resourceName: string, insightProperties: models.ApplicationInsightsComponent, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, resourceName: string, insightProperties: models.ApplicationInsightsComponent, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing component's tags. To update other fields use the - * CreateOrUpdate method. + * Create an API Key of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} componentTags Updated tag information to set into the - * component instance. + * @param {object} aPIKeyProperties Properties that need to be specified to + * create an API key of a Application Insights component. * - * @param {object} [componentTags.tags] Resource tags + * @param {string} [aPIKeyProperties.name] The name of the API Key. + * + * @param {array} [aPIKeyProperties.linkedReadProperties] The read access + * rights of this API Key. + * + * @param {array} [aPIKeyProperties.linkedWriteProperties] The write access + * rights of this API Key. * * @param {object} [options] Optional Parameters. * @@ -519,25 +534,30 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateTagsWithHttpOperationResponse(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing component's tags. To update other fields use the - * CreateOrUpdate method. + * Create an API Key of an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} componentTags Updated tag information to set into the - * component instance. + * @param {object} aPIKeyProperties Properties that need to be specified to + * create an API key of a Application Insights component. * - * @param {object} [componentTags.tags] Resource tags + * @param {string} [aPIKeyProperties.name] The name of the API Key. + * + * @param {array} [aPIKeyProperties.linkedReadProperties] The read access + * rights of this API Key. + * + * @param {array} [aPIKeyProperties.linkedWriteProperties] The write access + * rights of this API Key. * * @param {object} [options] Optional Parameters. * @@ -551,7 +571,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponent} - The deserialized result object. + * @resolve {ApplicationInsightsComponentAPIKey} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -559,24 +579,29 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponent} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponent} for more + * {ApplicationInsightsComponentAPIKey} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentAPIKey} 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. */ - updateTags(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - updateTags(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, callback: ServiceCallback): void; - updateTags(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of all Application Insights components within a subscription. + * Delete an API Key of an Application Insights component. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} keyId The API Key ID. This is unique within a Application + * Insights component. * * @param {object} [options] Optional Parameters. * @@ -585,19 +610,24 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of all Application Insights components within a subscription. + * Delete an API Key of an Application Insights component. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. * - * @param {object} [options] Optional Parameters. + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} keyId The API Key ID. This is unique within a Application + * Insights component. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -609,7 +639,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentListResult} - The deserialized result object. + * @resolve {ApplicationInsightsComponentAPIKey} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -617,24 +647,29 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentListResult} for - * more information. + * {ApplicationInsightsComponentAPIKey} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentAPIKey} 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; + deleteMethod(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, keyId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, keyId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of Application Insights components within a resource group. + * Get the API Key for this key id. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} keyId The API Key ID. This is unique within a Application + * Insights component. * * @param {object} [options] Optional Parameters. * @@ -643,17 +678,22 @@ export interface Components { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of Application Insights components within a resource group. + * Get the API Key for this key id. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} keyId The API Key ID. This is unique within a Application + * Insights component. * * @param {object} [options] Optional Parameters. * @@ -667,7 +707,7 @@ export interface Components { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentListResult} - The deserialized result object. + * @resolve {ApplicationInsightsComponentAPIKey} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -675,34 +715,37 @@ export interface Components { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentListResult} for - * more information. + * {ApplicationInsightsComponentAPIKey} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentAPIKey} 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; + get(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, keyId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, keyId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * WebTests + * ExportConfigurations * __NOTE__: An instance of this class is automatically created for an * instance of the ApplicationInsightsManagementClient. */ -export interface WebTests { +export interface ExportConfigurations { /** - * Get all Application Insights web tests defined within a specified resource - * group. + * Gets a list of Continuous Export configuration of an Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * + * @param {string} resourceName The name of the Application Insights component + * resource. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -710,18 +753,21 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get all Application Insights web tests defined within a specified resource - * group. + * Gets a list of Continuous Export configuration of an Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * + * @param {string} resourceName The name of the Application Insights component + * resource. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -734,7 +780,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTestListResult} - The deserialized result object. + * @resolve {Array} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -742,26 +788,57 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTestListResult} [result] - The deserialized result object if an error did not occur. - * See {@link WebTestListResult} for more information. + * {Array} [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. */ - 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(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Get a specific Application Insights web test definition. + * Create a Continuous Export configuration of an Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {object} exportProperties Properties that need to be specified to + * create a Continuous Export configuration of a Application Insights + * component. + * + * @param {string} [exportProperties.recordTypes] The document types to be + * exported, as comma separated values. Allowed values include 'Requests', + * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + * 'PerformanceCounters', 'Availability', 'Messages'. + * + * @param {string} [exportProperties.destinationType] The Continuous Export + * destination type. This has to be 'Blob'. + * + * @param {string} [exportProperties.destinationAddress] The SAS URL for the + * destination storage container. It must grant write permission. + * + * @param {string} [exportProperties.isEnabled] Set to 'true' to create a + * Continuous Export configuration as enabled, otherwise set it to 'false'. + * + * @param {string} [exportProperties.notificationQueueEnabled] Deprecated + * + * @param {string} [exportProperties.notificationQueueUri] Deprecated + * + * @param {string} [exportProperties.destinationStorageSubscriptionId] The + * subscription ID of the destination storage container. + * + * @param {string} [exportProperties.destinationStorageLocationId] The location + * ID of the destination storage container. + * + * @param {string} [exportProperties.destinationAccountId] The name of + * destination storage account. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -769,20 +846,52 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get a specific Application Insights web test definition. + * Create a Continuous Export configuration of an Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {object} exportProperties Properties that need to be specified to + * create a Continuous Export configuration of a Application Insights + * component. + * + * @param {string} [exportProperties.recordTypes] The document types to be + * exported, as comma separated values. Allowed values include 'Requests', + * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + * 'PerformanceCounters', 'Availability', 'Messages'. + * + * @param {string} [exportProperties.destinationType] The Continuous Export + * destination type. This has to be 'Blob'. + * + * @param {string} [exportProperties.destinationAddress] The SAS URL for the + * destination storage container. It must grant write permission. + * + * @param {string} [exportProperties.isEnabled] Set to 'true' to create a + * Continuous Export configuration as enabled, otherwise set it to 'false'. + * + * @param {string} [exportProperties.notificationQueueEnabled] Deprecated + * + * @param {string} [exportProperties.notificationQueueUri] Deprecated + * + * @param {string} [exportProperties.destinationStorageSubscriptionId] The + * subscription ID of the destination storage container. + * + * @param {string} [exportProperties.destinationStorageLocationId] The location + * ID of the destination storage container. + * + * @param {string} [exportProperties.destinationAccountId] The name of + * destination storage account. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -795,7 +904,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTest} - The deserialized result object. + * @resolve {Array} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -803,71 +912,28 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTest} [result] - The deserialized result object if an error did not occur. - * See {@link WebTest} for more information. + * {Array} [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. */ - get(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, webTestName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, webTestName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates an Application Insights web test definition. + * Delete a Continuous Export configuration of an Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} webTestDefinition Properties that need to be specified to - * create or update an Application Insights web test definition. - * - * @param {string} [webTestDefinition.kind] The kind of web test that this web - * test watches. Choices are ping and multistep. Possible values include: - * 'ping', 'multistep' - * - * @param {string} webTestDefinition.syntheticMonitorId Unique ID of this - * WebTest. This is typically the same value as the Name field. - * - * @param {string} webTestDefinition.webTestName User defined name if this - * WebTest. - * - * @param {string} [webTestDefinition.description] Purpose/user defined - * descriptive test for this WebTest. - * - * @param {boolean} [webTestDefinition.enabled] Is the test actively being - * monitored. - * - * @param {number} [webTestDefinition.frequency] Interval in seconds between - * test runs for this WebTest. Default value is 300. - * - * @param {number} [webTestDefinition.timeout] Seconds until this WebTest will - * timeout and fail. Default value is 30. - * - * @param {string} webTestDefinition.webTestKind The kind of web test this is, - * valid choices are ping and multistep. Possible values include: 'ping', - * 'multistep' - * - * @param {boolean} [webTestDefinition.retryEnabled] Allow for retries should - * this WebTest fail. - * - * @param {array} webTestDefinition.locations A list of where to physically run - * the tests from to give global coverage for accessibility of your - * application. - * - * @param {object} [webTestDefinition.configuration] An XML configuration - * specification for a WebTest. - * - * @param {string} [webTestDefinition.configuration.webTest] The XML - * specification of a WebTest to run against an application. - * - * @param {string} webTestDefinition.location Resource location - * - * @param {object} [webTestDefinition.tags] Resource tags + * @param {string} exportId The Continuous Export configuration ID. This is + * unique within a Application Insights component. * * @param {object} [options] Optional Parameters. * @@ -876,65 +942,1522 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates an Application Insights web test definition. + * Delete a Continuous Export configuration of an Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} webTestDefinition Properties that need to be specified to - * create or update an Application Insights web test definition. + * @param {string} exportId The Continuous Export configuration ID. This is + * unique within a Application Insights component. * - * @param {string} [webTestDefinition.kind] The kind of web test that this web - * test watches. Choices are ping and multistep. Possible values include: - * 'ping', 'multistep' + * @param {object} [options] Optional Parameters. * - * @param {string} webTestDefinition.syntheticMonitorId Unique ID of this - * WebTest. This is typically the same value as the Name field. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} webTestDefinition.webTestName User defined name if this - * WebTest. + * @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 {ApplicationInsightsComponentExportConfiguration} - 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. + * + * {ApplicationInsightsComponentExportConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentExportConfiguration} 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. + */ + deleteMethod(resourceGroupName: string, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, exportId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, exportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the Continuous Export configuration for this export id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} exportId The Continuous Export configuration ID. This is + * unique within a Application Insights component. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the Continuous Export configuration for this export id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} exportId The Continuous Export configuration ID. This is + * unique within a Application Insights component. + * + * @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 {ApplicationInsightsComponentExportConfiguration} - 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. + * + * {ApplicationInsightsComponentExportConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentExportConfiguration} 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, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, exportId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, exportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the Continuous Export configuration for this export id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} exportId The Continuous Export configuration ID. This is + * unique within a Application Insights component. + * + * @param {object} exportProperties Properties that need to be specified to + * update the Continuous Export configuration. + * + * @param {string} [exportProperties.recordTypes] The document types to be + * exported, as comma separated values. Allowed values include 'Requests', + * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + * 'PerformanceCounters', 'Availability', 'Messages'. + * + * @param {string} [exportProperties.destinationType] The Continuous Export + * destination type. This has to be 'Blob'. + * + * @param {string} [exportProperties.destinationAddress] The SAS URL for the + * destination storage container. It must grant write permission. + * + * @param {string} [exportProperties.isEnabled] Set to 'true' to create a + * Continuous Export configuration as enabled, otherwise set it to 'false'. + * + * @param {string} [exportProperties.notificationQueueEnabled] Deprecated + * + * @param {string} [exportProperties.notificationQueueUri] Deprecated + * + * @param {string} [exportProperties.destinationStorageSubscriptionId] The + * subscription ID of the destination storage container. + * + * @param {string} [exportProperties.destinationStorageLocationId] The location + * ID of the destination storage container. + * + * @param {string} [exportProperties.destinationAccountId] The name of + * destination storage account. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the Continuous Export configuration for this export id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} exportId The Continuous Export configuration ID. This is + * unique within a Application Insights component. + * + * @param {object} exportProperties Properties that need to be specified to + * update the Continuous Export configuration. + * + * @param {string} [exportProperties.recordTypes] The document types to be + * exported, as comma separated values. Allowed values include 'Requests', + * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + * 'PerformanceCounters', 'Availability', 'Messages'. + * + * @param {string} [exportProperties.destinationType] The Continuous Export + * destination type. This has to be 'Blob'. + * + * @param {string} [exportProperties.destinationAddress] The SAS URL for the + * destination storage container. It must grant write permission. + * + * @param {string} [exportProperties.isEnabled] Set to 'true' to create a + * Continuous Export configuration as enabled, otherwise set it to 'false'. + * + * @param {string} [exportProperties.notificationQueueEnabled] Deprecated + * + * @param {string} [exportProperties.notificationQueueUri] Deprecated + * + * @param {string} [exportProperties.destinationStorageSubscriptionId] The + * subscription ID of the destination storage container. + * + * @param {string} [exportProperties.destinationStorageLocationId] The location + * ID of the destination storage container. + * + * @param {string} [exportProperties.destinationAccountId] The name of + * destination storage account. + * + * @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 {ApplicationInsightsComponentExportConfiguration} - 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. + * + * {ApplicationInsightsComponentExportConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentExportConfiguration} 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, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, callback: ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ComponentCurrentBillingFeatures + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface ComponentCurrentBillingFeatures { + + + /** + * Returns current billing features for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns current billing features for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponentBillingFeatures} - 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. + * + * {ApplicationInsightsComponentBillingFeatures} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentBillingFeatures} + * 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update current billing features for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} billingFeaturesProperties Properties that need to be + * specified to update billing features for an Application Insights component. + * + * @param {object} [billingFeaturesProperties.dataVolumeCap] An Application + * Insights component daily data volumne cap + * + * @param {number} [billingFeaturesProperties.dataVolumeCap.cap] Daily data + * volume cap in GB. + * + * @param {number} [billingFeaturesProperties.dataVolumeCap.warningThreshold] + * Reserved, not used for now. + * + * @param {boolean} + * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitThreshold] + * Reserved, not used for now. + * + * @param {boolean} + * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitCap] Do + * not send a notification email when the daily data volume cap is met. + * + * @param {array} [billingFeaturesProperties.currentBillingFeatures] Current + * enabled pricing plan. When the component is in the Enterprise plan, this + * will list both 'Basic' and 'Application Insights Enterprise'. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update current billing features for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} billingFeaturesProperties Properties that need to be + * specified to update billing features for an Application Insights component. + * + * @param {object} [billingFeaturesProperties.dataVolumeCap] An Application + * Insights component daily data volumne cap + * + * @param {number} [billingFeaturesProperties.dataVolumeCap.cap] Daily data + * volume cap in GB. + * + * @param {number} [billingFeaturesProperties.dataVolumeCap.warningThreshold] + * Reserved, not used for now. + * + * @param {boolean} + * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitThreshold] + * Reserved, not used for now. + * + * @param {boolean} + * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitCap] Do + * not send a notification email when the daily data volume cap is met. + * + * @param {array} [billingFeaturesProperties.currentBillingFeatures] Current + * enabled pricing plan. When the component is in the Enterprise plan, this + * will list both 'Basic' and 'Application Insights Enterprise'. + * + * @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 {ApplicationInsightsComponentBillingFeatures} - 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. + * + * {ApplicationInsightsComponentBillingFeatures} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentBillingFeatures} + * 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, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, callback: ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ComponentQuotaStatus + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface ComponentQuotaStatus { + + + /** + * Returns daily data volume cap (quota) status for an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns daily data volume cap (quota) status for an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponentQuotaStatus} - 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. + * + * {ApplicationInsightsComponentQuotaStatus} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentQuotaStatus} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ComponentFeatureCapabilities + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface ComponentFeatureCapabilities { + + + /** + * Returns feature capabilites of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns feature capabilites of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponentFeatureCapabilities} - 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. + * + * {ApplicationInsightsComponentFeatureCapabilities} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentFeatureCapabilities} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ComponentAvailableFeatures + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface ComponentAvailableFeatures { + + + /** + * Returns all available features of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns all available features of the application insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponentAvailableFeatures} - 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. + * + * {ApplicationInsightsComponentAvailableFeatures} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentAvailableFeatures} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ProactiveDetectionConfigurations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface ProactiveDetectionConfigurations { + + + /** + * Gets a list of ProactiveDetection configurations of an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of ProactiveDetection configurations of an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {Array} - 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. + * + * {Array} [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. + */ + list(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName: string, configurationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @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 {ApplicationInsightsComponentProactiveDetectionConfiguration} - 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. + * + * {ApplicationInsightsComponentProactiveDetectionConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentProactiveDetectionConfiguration} + * 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, resourceName: string, configurationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, configurationId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, configurationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} proactiveDetectionProperties Properties that need to be + * specified to update the ProactiveDetection configuration. + * + * @param {string} [proactiveDetectionProperties.name] The rule name + * + * @param {boolean} [proactiveDetectionProperties.enabled] A flag that + * indicates whether this rule is enabled by the user + * + * @param {boolean} + * [proactiveDetectionProperties.sendEmailsToSubscriptionOwners] A flag that + * indicated whether notifications on this rule should be sent to subscription + * owners + * + * @param {array} [proactiveDetectionProperties.customEmails] Custom email + * addresses for this rule notifications + * + * @param {string} [proactiveDetectionProperties.lastUpdatedTime] The last time + * this rule was updated + * + * @param {object} [proactiveDetectionProperties.ruleDefinitions] Static + * definitions of the ProactiveDetection configuration rule (same values for + * all components). + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.name] The rule + * name + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.displayName] + * The rule name as it is displayed in UI + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.description] + * The rule description + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.helpUrl] URL + * which displays aditional info about the proactive detection rule + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isHidden] A + * flag indicating whether the rule is hidden (from the UI) + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.isEnabledByDefault] A flag + * indicating whether the rule is enabled by default + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isInPreview] + * A flag indicating whether the rule is in preview + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.supportsEmailNotifications] A + * flag indicating whether email notifications are supported for detections for + * this 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. + */ + updateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, configurationId: string, proactiveDetectionProperties: models.ApplicationInsightsComponentProactiveDetectionConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} proactiveDetectionProperties Properties that need to be + * specified to update the ProactiveDetection configuration. + * + * @param {string} [proactiveDetectionProperties.name] The rule name + * + * @param {boolean} [proactiveDetectionProperties.enabled] A flag that + * indicates whether this rule is enabled by the user + * + * @param {boolean} + * [proactiveDetectionProperties.sendEmailsToSubscriptionOwners] A flag that + * indicated whether notifications on this rule should be sent to subscription + * owners + * + * @param {array} [proactiveDetectionProperties.customEmails] Custom email + * addresses for this rule notifications + * + * @param {string} [proactiveDetectionProperties.lastUpdatedTime] The last time + * this rule was updated + * + * @param {object} [proactiveDetectionProperties.ruleDefinitions] Static + * definitions of the ProactiveDetection configuration rule (same values for + * all components). + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.name] The rule + * name + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.displayName] + * The rule name as it is displayed in UI + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.description] + * The rule description + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.helpUrl] URL + * which displays aditional info about the proactive detection rule + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isHidden] A + * flag indicating whether the rule is hidden (from the UI) + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.isEnabledByDefault] A flag + * indicating whether the rule is enabled by default + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isInPreview] + * A flag indicating whether the rule is in preview + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.supportsEmailNotifications] A + * flag indicating whether email notifications are supported for detections for + * this 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 {ApplicationInsightsComponentProactiveDetectionConfiguration} - 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. + * + * {ApplicationInsightsComponentProactiveDetectionConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationInsightsComponentProactiveDetectionConfiguration} + * 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, resourceName: string, configurationId: string, proactiveDetectionProperties: models.ApplicationInsightsComponentProactiveDetectionConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, resourceName: string, configurationId: string, proactiveDetectionProperties: models.ApplicationInsightsComponentProactiveDetectionConfiguration, callback: ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, configurationId: string, proactiveDetectionProperties: models.ApplicationInsightsComponentProactiveDetectionConfiguration, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Components + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface Components { + + + /** + * Gets a list of all Application Insights components 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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of all Application Insights components 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 {ApplicationInsightsComponentListResult} - 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. + * + * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentListResult} 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; + + + /** + * Gets a list of Application Insights components 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>; + + /** + * Gets a list of Application Insights components 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 {ApplicationInsightsComponentListResult} - 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. + * + * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentListResult} 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; + + + /** + * Deletes an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsComponent} - 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. + * + * {ApplicationInsightsComponent} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponent} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates (or updates) an Application Insights component. Note: You cannot + * specify a different value for InstrumentationKey nor AppId in the Put + * operation. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} insightProperties Properties that need to be specified to + * create an Application Insights component. + * + * @param {string} insightProperties.kind The kind of application that this + * component refers to, used to customize UI. This value is a freeform string, + * values should typically be one of the following: web, ios, other, store, + * java, phone. + * + * @param {string} insightProperties.applicationType Type of application being + * monitored. Possible values include: 'web', 'other' + * + * @param {string} [insightProperties.flowType] Used by the Application + * Insights system to determine what kind of flow this component was created + * by. This is to be set to 'Bluefield' when creating/updating a component via + * the REST API. Possible values include: 'Bluefield' + * + * @param {string} [insightProperties.requestSource] Describes what tool + * created this Application Insights component. Customers using this API should + * set this to the default 'rest'. Possible values include: 'rest' + * + * @param {string} [insightProperties.hockeyAppId] The unique application ID + * created when a new application is added to HockeyApp, used for + * communications with HockeyApp. + * + * @param {number} [insightProperties.samplingPercentage] Percentage of the + * data produced by the application being monitored that is being sampled for + * Application Insights telemetry. + * + * @param {string} insightProperties.location Resource location + * + * @param {object} [insightProperties.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, resourceName: string, insightProperties: models.ApplicationInsightsComponent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates (or updates) an Application Insights component. Note: You cannot + * specify a different value for InstrumentationKey nor AppId in the Put + * operation. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} insightProperties Properties that need to be specified to + * create an Application Insights component. + * + * @param {string} insightProperties.kind The kind of application that this + * component refers to, used to customize UI. This value is a freeform string, + * values should typically be one of the following: web, ios, other, store, + * java, phone. + * + * @param {string} insightProperties.applicationType Type of application being + * monitored. Possible values include: 'web', 'other' + * + * @param {string} [insightProperties.flowType] Used by the Application + * Insights system to determine what kind of flow this component was created + * by. This is to be set to 'Bluefield' when creating/updating a component via + * the REST API. Possible values include: 'Bluefield' + * + * @param {string} [insightProperties.requestSource] Describes what tool + * created this Application Insights component. Customers using this API should + * set this to the default 'rest'. Possible values include: 'rest' + * + * @param {string} [insightProperties.hockeyAppId] The unique application ID + * created when a new application is added to HockeyApp, used for + * communications with HockeyApp. + * + * @param {number} [insightProperties.samplingPercentage] Percentage of the + * data produced by the application being monitored that is being sampled for + * Application Insights telemetry. + * + * @param {string} insightProperties.location Resource location + * + * @param {object} [insightProperties.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 {ApplicationInsightsComponent} - 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. + * + * {ApplicationInsightsComponent} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponent} 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, resourceName: string, insightProperties: models.ApplicationInsightsComponent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, resourceName: string, insightProperties: models.ApplicationInsightsComponent, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, resourceName: string, insightProperties: models.ApplicationInsightsComponent, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing component's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} componentTags Updated tag information to set into the + * component instance. + * + * @param {object} [componentTags.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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing component's tags. To update other fields use the + * CreateOrUpdate method. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} componentTags Updated tag information to set into the + * component instance. + * + * @param {object} [componentTags.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 {ApplicationInsightsComponent} - 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. + * + * {ApplicationInsightsComponent} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponent} 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. + */ + updateTags(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, resourceName: string, componentTags: models.TagsResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Purges data in an Application Insights component by a set of user-defined + * filters. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} body Describes the body of a request to purge data in a + * single table of an Application Insights component + * + * @param {string} body.table Table from which to purge data. + * + * @param {array} body.filters The set of columns and filters (queries) to run + * over them to purge the resulting data. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + purgeWithHttpOperationResponse(resourceGroupName: string, resourceName: string, body: models.ComponentPurgeBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Purges data in an Application Insights component by a set of user-defined + * filters. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} body Describes the body of a request to purge data in a + * single table of an Application Insights component + * + * @param {string} body.table Table from which to purge data. + * + * @param {array} body.filters The set of columns and filters (queries) to run + * over them to purge the resulting data. + * + * @param {object} [options] Optional Parameters. * - * @param {string} [webTestDefinition.description] Purpose/user defined - * descriptive test for this WebTest. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {boolean} [webTestDefinition.enabled] Is the test actively being - * monitored. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {number} [webTestDefinition.frequency] Interval in seconds between - * test runs for this WebTest. Default value is 300. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {number} [webTestDefinition.timeout] Seconds until this WebTest will - * timeout and fail. Default value is 30. + * {Promise} A promise is returned. * - * @param {string} webTestDefinition.webTestKind The kind of web test this is, - * valid choices are ping and multistep. Possible values include: 'ping', - * 'multistep' + * @resolve {ComponentPurgeResponse} - The deserialized result object. * - * @param {boolean} [webTestDefinition.retryEnabled] Allow for retries should - * this WebTest fail. + * @reject {Error|ServiceError} - The error object. * - * @param {array} webTestDefinition.locations A list of where to physically run - * the tests from to give global coverage for accessibility of your - * application. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {object} [webTestDefinition.configuration] An XML configuration - * specification for a WebTest. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [webTestDefinition.configuration.webTest] The XML - * specification of a WebTest to run against an application. + * {ComponentPurgeResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ComponentPurgeResponse} for more + * information. * - * @param {string} webTestDefinition.location Resource location + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {object} [webTestDefinition.tags] Resource tags + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + purge(resourceGroupName: string, resourceName: string, body: models.ComponentPurgeBody, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + purge(resourceGroupName: string, resourceName: string, body: models.ComponentPurgeBody, callback: ServiceCallback): void; + purge(resourceGroupName: string, resourceName: string, body: models.ComponentPurgeBody, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the status of a previously submitted purge using the id returned from + * the original purge request. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} purgeId In a purge status request, this is the Id of the + * operation the status of which is returned. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + getPurgeStatusWithHttpOperationResponse(resourceGroupName: string, resourceName: string, purgeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the status of a previously submitted purge using the id returned from + * the original purge request. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} purgeId In a purge status request, this is the Id of the + * operation the status of which is returned. * * @param {object} [options] Optional Parameters. * @@ -948,7 +2471,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTest} - The deserialized result object. + * @resolve {ComponentPurgeStatusResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -956,30 +2479,227 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTest} [result] - The deserialized result object if an error did not occur. - * See {@link WebTest} for more information. + * {ComponentPurgeStatusResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ComponentPurgeStatusResponse} 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, webTestName: string, webTestDefinition: models.WebTest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getPurgeStatus(resourceGroupName: string, resourceName: string, purgeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getPurgeStatus(resourceGroupName: string, resourceName: string, purgeId: string, callback: ServiceCallback): void; + getPurgeStatus(resourceGroupName: string, resourceName: string, purgeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates an Application Insights web test definition. + * Gets a list of all Application Insights components within 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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of all Application Insights components within 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 {ApplicationInsightsComponentListResult} - 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. + * + * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentListResult} 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; + + + /** + * Gets a list of Application Insights components within 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>; + + /** + * Gets a list of Application Insights components within 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 {ApplicationInsightsComponentListResult} - 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. + * + * {ApplicationInsightsComponentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentListResult} 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 + * WorkItemConfigurations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface WorkItemConfigurations { + + + /** + * Gets the list work item configurations that exist for the application * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} webTestTags Updated tag information to set into the web test - * instance. + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {Array} - 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. + * + * {Array} [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. + */ + list(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a work item configuration for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} workItemConfigurationProperties Properties that need to be + * specified to create a work item configuration of a Application Insights + * component. + * + * @param {string} [workItemConfigurationProperties.connectorId] Unique + * connector id + * + * @param {string} [workItemConfigurationProperties.connectorDataConfiguration] + * Serialized JSON object for detaile d properties + * + * @param {boolean} [workItemConfigurationProperties.validateOnly] Boolean + * indicating validate only * - * @param {object} [webTestTags.tags] Resource tags + * @param {string} [workItemConfigurationProperties.workItemProperties] Custom + * work item properties * * @param {object} [options] Optional Parameters. * @@ -988,24 +2708,35 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateTagsWithHttpOperationResponse(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, resourceName: string, workItemConfigurationProperties: models.WorkItemCreateConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates an Application Insights web test definition. + * Create a work item configuration for an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} webTestTags Updated tag information to set into the web test - * instance. + * @param {object} workItemConfigurationProperties Properties that need to be + * specified to create a work item configuration of a Application Insights + * component. * - * @param {object} [webTestTags.tags] Resource tags + * @param {string} [workItemConfigurationProperties.connectorId] Unique + * connector id + * + * @param {string} [workItemConfigurationProperties.connectorDataConfiguration] + * Serialized JSON object for detaile d properties + * + * @param {boolean} [workItemConfigurationProperties.validateOnly] Boolean + * indicating validate only + * + * @param {string} [workItemConfigurationProperties.workItemProperties] Custom + * work item properties * * @param {object} [options] Optional Parameters. * @@ -1019,7 +2750,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTest} - The deserialized result object. + * @resolve {WorkItemConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1027,24 +2758,24 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTest} [result] - The deserialized result object if an error did not occur. - * See {@link WebTest} for more information. + * {WorkItemConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link WorkItemConfiguration} 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. */ - updateTags(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - updateTags(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, callback: ServiceCallback): void; - updateTags(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, workItemConfigurationProperties: models.WorkItemCreateConfiguration, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, resourceName: string, workItemConfigurationProperties: models.WorkItemCreateConfiguration, callback: ServiceCallback): void; + create(resourceGroupName: string, resourceName: string, workItemConfigurationProperties: models.WorkItemCreateConfiguration, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes an Application Insights web test. + * Gets default work item configurations that exist for the application * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * * @param {object} [options] Optional Parameters. @@ -1054,18 +2785,18 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getDefaultWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes an Application Insights web test. + * Gets default work item configurations that exist for the application * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} webTestName The name of the Application Insights webtest + * @param {string} resourceName The name of the Application Insights component * resource. * * @param {object} [options] Optional Parameters. @@ -1080,7 +2811,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {WorkItemConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1088,20 +2819,29 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {WorkItemConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link WorkItemConfiguration} 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. */ - deleteMethod(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, webTestName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, webTestName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getDefault(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getDefault(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + getDefault(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Get all Application Insights web test alerts definitioned within a - * subscription. + * Delete an workitem configuration of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} workItemConfigId The unique work item configuration Id. This + * can be either friendly name of connector as defined in connector + * configuration * * @param {object} [options] Optional Parameters. * @@ -1110,15 +2850,23 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, workItemConfigId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get all Application Insights web test alerts definitioned within a - * subscription. + * Delete an workitem configuration of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} workItemConfigId The unique work item configuration Id. This + * can be either friendly name of connector as defined in connector + * configuration * * @param {object} [options] Optional Parameters. * @@ -1132,7 +2880,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTestListResult} - The deserialized result object. + * @resolve {Object} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1140,47 +2888,87 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTestListResult} [result] - The deserialized result object if an error did not occur. - * See {@link WebTestListResult} for more information. + * {Object} [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. */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, workItemConfigId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, workItemConfigId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, workItemConfigId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Favorites + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface Favorites { /** - * Get all Application Insights web tests defined within a specified resource - * group. + * Gets a list of favorites defined within an Application Insights component. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.favoriteType] The type of favorite. Value can be + * either shared or user. Possible values include: 'shared', 'user' + * + * @param {string} [options.sourceType] Source type of favorite to return. When + * left out, the source type defaults to 'other' (not present in this enum). + * Possible values include: 'retention', 'notebook', 'sessions', 'events', + * 'userflows', 'funnel', 'impact', 'segmentation' + * + * @param {boolean} [options.canFetchContent] Flag indicating whether or not to + * return the full content for each applicable favorite. If false, only return + * summary content for favorites. + * + * @param {array} [options.tags] Tags that must be present on each favorite + * returned. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { favoriteType? : string, sourceType? : string, canFetchContent? : boolean, tags? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get all Application Insights web tests defined within a specified resource - * group. + * Gets a list of favorites defined within an Application Insights component. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.favoriteType] The type of favorite. Value can be + * either shared or user. Possible values include: 'shared', 'user' + * + * @param {string} [options.sourceType] Source type of favorite to return. When + * left out, the source type defaults to 'other' (not present in this enum). + * Possible values include: 'retention', 'notebook', 'sessions', 'events', + * 'userflows', 'funnel', 'impact', 'segmentation' + * + * @param {boolean} [options.canFetchContent] Flag indicating whether or not to + * return the full content for each applicable favorite. If false, only return + * summary content for favorites. + * + * @param {array} [options.tags] Tags that must be present on each favorite + * returned. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1191,7 +2979,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTestListResult} - The deserialized result object. + * @resolve {Array} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1199,24 +2987,37 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTestListResult} [result] - The deserialized result object if an error did not occur. - * See {@link WebTestListResult} for more information. + * {Array} [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. */ - 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; + list(resourceGroupName: string, resourceName: string, options?: { favoriteType? : string, sourceType? : string, canFetchContent? : boolean, tags? : string[], customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options: { favoriteType? : string, sourceType? : string, canFetchContent? : boolean, tags? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Favorite + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface Favorite { /** - * Get all Application Insights web test alerts definitioned within a - * subscription. + * Get a single favorite by its FavoriteId, defined within an Application + * Insights component. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component * * @param {object} [options] Optional Parameters. * @@ -1225,18 +3026,23 @@ export interface WebTests { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, favoriteId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get all Application Insights web test alerts definitioned within a - * subscription. + * Get a single favorite by its FavoriteId, defined within an Application + * Insights component. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component * * @param {object} [options] Optional Parameters. * @@ -1250,7 +3056,7 @@ export interface WebTests { * * {Promise} A promise is returned. * - * @resolve {WebTestListResult} - The deserialized result object. + * @resolve {ApplicationInsightsComponentFavorite} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1258,36 +3064,61 @@ export interface WebTests { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebTestListResult} [result] - The deserialized result object if an error did not occur. - * See {@link WebTestListResult} for more information. + * {ApplicationInsightsComponentFavorite} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentFavorite} 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 - * ExportConfigurations - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApplicationInsightsManagementClient. - */ -export interface ExportConfigurations { + get(resourceGroupName: string, resourceName: string, favoriteId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, resourceName: string, favoriteId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, resourceName: string, favoriteId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of Continuous Export configuration of an Application Insights - * component. + * Adds a new favorites to an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * create a new favorite and add it to an Application Insights component. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1295,21 +3126,54 @@ export interface ExportConfigurations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + addWithHttpOperationResponse(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of Continuous Export configuration of an Application Insights - * component. + * Adds a new favorites to an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component + * + * @param {object} favoriteProperties Properties that need to be specified to + * create a new favorite and add it to an Application Insights component. + * + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. + * + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON + * + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. + * + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' + * + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. + * + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition + * + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. + * + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1322,7 +3186,7 @@ export interface ExportConfigurations { * * {Promise} A promise is returned. * - * @resolve {Array} - The deserialized result object. + * @resolve {ApplicationInsightsComponentFavorite} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1330,19 +3194,21 @@ export interface ExportConfigurations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Array} [result] - The deserialized result object if an error did not occur. + * {ApplicationInsightsComponentFavorite} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentFavorite} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + add(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + add(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, callback: ServiceCallback): void; + add(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create a Continuous Export configuration of an Application Insights + * Updates a favorite that has already been added to an Application Insights * component. * * @param {string} resourceGroupName The name of the resource group. @@ -1350,36 +3216,39 @@ export interface ExportConfigurations { * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} exportProperties Properties that need to be specified to - * create a Continuous Export configuration of a Application Insights - * component. + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component * - * @param {string} [exportProperties.recordTypes] The document types to be - * exported, as comma separated values. Allowed values include 'Requests', - * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', - * 'PerformanceCounters', 'Availability', 'Messages'. + * @param {object} favoriteProperties Properties that need to be specified to + * update the existing favorite. * - * @param {string} [exportProperties.destinationType] The Continuous Export - * destination type. This has to be 'Blob'. + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. * - * @param {string} [exportProperties.destinationAddress] The SAS URL for the - * destination storage container. It must grant write permission. + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON * - * @param {string} [exportProperties.isEnabled] Set to 'true' to create a - * Continuous Export configuration as enabled, otherwise set it to 'false'. + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. * - * @param {string} [exportProperties.notificationQueueEnabled] Deprecated + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' * - * @param {string} [exportProperties.notificationQueueUri] Deprecated + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. * - * @param {string} [exportProperties.destinationStorageSubscriptionId] The - * subscription ID of the destination storage container. + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition * - * @param {string} [exportProperties.destinationStorageLocationId] The location - * ID of the destination storage container. + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. * - * @param {string} [exportProperties.destinationAccountId] The name of - * destination storage account. + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. * * @param {object} [options] Optional Parameters. * @@ -1388,14 +3257,14 @@ export interface ExportConfigurations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a Continuous Export configuration of an Application Insights + * Updates a favorite that has already been added to an Application Insights * component. * * @param {string} resourceGroupName The name of the resource group. @@ -1403,36 +3272,39 @@ export interface ExportConfigurations { * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {object} exportProperties Properties that need to be specified to - * create a Continuous Export configuration of a Application Insights - * component. + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component * - * @param {string} [exportProperties.recordTypes] The document types to be - * exported, as comma separated values. Allowed values include 'Requests', - * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', - * 'PerformanceCounters', 'Availability', 'Messages'. + * @param {object} favoriteProperties Properties that need to be specified to + * update the existing favorite. * - * @param {string} [exportProperties.destinationType] The Continuous Export - * destination type. This has to be 'Blob'. + * @param {string} [favoriteProperties.name] The user-defined name of the + * favorite. * - * @param {string} [exportProperties.destinationAddress] The SAS URL for the - * destination storage container. It must grant write permission. + * @param {string} [favoriteProperties.config] Configuration of this particular + * favorite, which are driven by the Azure portal UX. Configuration data is a + * string containing valid JSON * - * @param {string} [exportProperties.isEnabled] Set to 'true' to create a - * Continuous Export configuration as enabled, otherwise set it to 'false'. + * @param {string} [favoriteProperties.version] This instance's version of the + * data model. This can change as new features are added that can be marked + * favorite. Current examples include MetricsExplorer (ME) and Search. * - * @param {string} [exportProperties.notificationQueueEnabled] Deprecated + * @param {string} [favoriteProperties.favoriteType] Enum indicating if this + * favorite definition is owned by a specific user or is shared between all + * users with access to the Application Insights component. Possible values + * include: 'shared', 'user' * - * @param {string} [exportProperties.notificationQueueUri] Deprecated + * @param {string} [favoriteProperties.sourceType] The source of the favorite + * definition. * - * @param {string} [exportProperties.destinationStorageSubscriptionId] The - * subscription ID of the destination storage container. + * @param {array} [favoriteProperties.tags] A list of 0 or more tags that are + * associated with this favorite definition * - * @param {string} [exportProperties.destinationStorageLocationId] The location - * ID of the destination storage container. + * @param {string} [favoriteProperties.category] Favorite category, as defined + * by the user at creation time. * - * @param {string} [exportProperties.destinationAccountId] The name of - * destination storage account. + * @param {boolean} [favoriteProperties.isGeneratedFromTemplate] Flag denoting + * wether or not this favorite was generated from a template. * * @param {object} [options] Optional Parameters. * @@ -1446,7 +3318,7 @@ export interface ExportConfigurations { * * {Promise} A promise is returned. * - * @resolve {Array} - The deserialized result object. + * @resolve {ApplicationInsightsComponentFavorite} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1454,28 +3326,29 @@ export interface ExportConfigurations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Array} [result] - The deserialized result object if an error did not occur. + * {ApplicationInsightsComponentFavorite} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationInsightsComponentFavorite} 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. */ - create(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, callback: ServiceCallback): void; - create(resourceGroupName: string, resourceName: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, callback: ServiceCallback): void; + update(resourceGroupName: string, resourceName: string, favoriteId: string, favoriteProperties: models.ApplicationInsightsComponentFavorite, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete a Continuous Export configuration of an Application Insights - * component. + * Remove a favorite that is associated to an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {string} exportId The Continuous Export configuration ID. This is - * unique within a Application Insights component. + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component * * @param {object} [options] Optional Parameters. * @@ -1484,23 +3357,22 @@ export interface ExportConfigurations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, favoriteId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete a Continuous Export configuration of an Application Insights - * component. + * Remove a favorite that is associated to an Application Insights component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {string} exportId The Continuous Export configuration ID. This is - * unique within a Application Insights component. + * @param {string} favoriteId The Id of a specific favorite defined in the + * Application Insights component * * @param {object} [options] Optional Parameters. * @@ -1514,7 +3386,7 @@ export interface ExportConfigurations { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentExportConfiguration} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1522,31 +3394,35 @@ export interface ExportConfigurations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentExportConfiguration} [result] - The deserialized result object if an error did not occur. - * See {@link - * ApplicationInsightsComponentExportConfiguration} for - * more information. + * {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, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, resourceName: string, exportId: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, resourceName: string, exportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, favoriteId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, resourceName: string, favoriteId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, resourceName: string, favoriteId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * WebTestLocations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface WebTestLocations { /** - * Get the Continuous Export configuration for this export id. + * Gets a list of web test locations available to this Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {string} exportId The Continuous Export configuration ID. This is - * unique within a Application Insights component. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1554,23 +3430,21 @@ export interface ExportConfigurations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get the Continuous Export configuration for this export id. + * Gets a list of web test locations available to this Application Insights + * component. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} resourceName The name of the Application Insights component * resource. * - * @param {string} exportId The Continuous Export configuration ID. This is - * unique within a Application Insights component. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1583,7 +3457,7 @@ export interface ExportConfigurations { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentExportConfiguration} - The deserialized result object. + * @resolve {ApplicationInsightsWebTestLocationsListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1591,61 +3465,35 @@ export interface ExportConfigurations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentExportConfiguration} [result] - The deserialized result object if an error did not occur. + * {ApplicationInsightsWebTestLocationsListResult} [result] - The deserialized result object if an error did not occur. * See {@link - * ApplicationInsightsComponentExportConfiguration} for - * more information. + * ApplicationInsightsWebTestLocationsListResult} 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, resourceName: string, exportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, resourceName: string, exportId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, exportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * WebTests + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApplicationInsightsManagementClient. + */ +export interface WebTests { /** - * Update the Continuous Export configuration for this export id. + * Get all Application Insights web tests defined within a specified resource + * group. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component - * resource. - * - * @param {string} exportId The Continuous Export configuration ID. This is - * unique within a Application Insights component. - * - * @param {object} exportProperties Properties that need to be specified to - * update the Continuous Export configuration. - * - * @param {string} [exportProperties.recordTypes] The document types to be - * exported, as comma separated values. Allowed values include 'Requests', - * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', - * 'PerformanceCounters', 'Availability', 'Messages'. - * - * @param {string} [exportProperties.destinationType] The Continuous Export - * destination type. This has to be 'Blob'. - * - * @param {string} [exportProperties.destinationAddress] The SAS URL for the - * destination storage container. It must grant write permission. - * - * @param {string} [exportProperties.isEnabled] Set to 'true' to create a - * Continuous Export configuration as enabled, otherwise set it to 'false'. - * - * @param {string} [exportProperties.notificationQueueEnabled] Deprecated - * - * @param {string} [exportProperties.notificationQueueUri] Deprecated - * - * @param {string} [exportProperties.destinationStorageSubscriptionId] The - * subscription ID of the destination storage container. - * - * @param {string} [exportProperties.destinationStorageLocationId] The location - * ID of the destination storage container. - * - * @param {string} [exportProperties.destinationAccountId] The name of - * destination storage account. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1653,53 +3501,18 @@ export interface ExportConfigurations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update the Continuous Export configuration for this export id. + * Get all Application Insights web tests defined within a specified resource + * group. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component - * resource. - * - * @param {string} exportId The Continuous Export configuration ID. This is - * unique within a Application Insights component. - * - * @param {object} exportProperties Properties that need to be specified to - * update the Continuous Export configuration. - * - * @param {string} [exportProperties.recordTypes] The document types to be - * exported, as comma separated values. Allowed values include 'Requests', - * 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', - * 'PerformanceCounters', 'Availability', 'Messages'. - * - * @param {string} [exportProperties.destinationType] The Continuous Export - * destination type. This has to be 'Blob'. - * - * @param {string} [exportProperties.destinationAddress] The SAS URL for the - * destination storage container. It must grant write permission. - * - * @param {string} [exportProperties.isEnabled] Set to 'true' to create a - * Continuous Export configuration as enabled, otherwise set it to 'false'. - * - * @param {string} [exportProperties.notificationQueueEnabled] Deprecated - * - * @param {string} [exportProperties.notificationQueueUri] Deprecated - * - * @param {string} [exportProperties.destinationStorageSubscriptionId] The - * subscription ID of the destination storage container. - * - * @param {string} [exportProperties.destinationStorageLocationId] The location - * ID of the destination storage container. - * - * @param {string} [exportProperties.destinationAccountId] The name of - * destination storage account. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1712,7 +3525,7 @@ export interface ExportConfigurations { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentExportConfiguration} - The deserialized result object. + * @resolve {WebTestListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1720,35 +3533,24 @@ export interface ExportConfigurations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentExportConfiguration} [result] - The deserialized result object if an error did not occur. - * See {@link - * ApplicationInsightsComponentExportConfiguration} for - * more information. + * {WebTestListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebTestListResult} 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, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, callback: ServiceCallback): void; - update(resourceGroupName: string, resourceName: string, exportId: string, exportProperties: models.ApplicationInsightsComponentExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ComponentCurrentBillingFeatures - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApplicationInsightsManagementClient. - */ -export interface ComponentCurrentBillingFeatures { + 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; /** - * Returns current billing features for an Application Insights component. + * Get a specific Application Insights web test definition. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * * @param {object} [options] Optional Parameters. @@ -1758,18 +3560,18 @@ export interface ComponentCurrentBillingFeatures { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns current billing features for an Application Insights component. + * Get a specific Application Insights web test definition. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * * @param {object} [options] Optional Parameters. @@ -1784,7 +3586,7 @@ export interface ComponentCurrentBillingFeatures { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentBillingFeatures} - The deserialized result object. + * @resolve {WebTest} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1792,50 +3594,71 @@ export interface ComponentCurrentBillingFeatures { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentBillingFeatures} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentBillingFeatures} - * for more information. + * {WebTest} [result] - The deserialized result object if an error did not occur. + * See {@link WebTest} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, webTestName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, webTestName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update current billing features for an Application Insights component. + * Creates or updates an Application Insights web test definition. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * - * @param {object} billingFeaturesProperties Properties that need to be - * specified to update billing features for an Application Insights component. + * @param {object} webTestDefinition Properties that need to be specified to + * create or update an Application Insights web test definition. * - * @param {object} [billingFeaturesProperties.dataVolumeCap] An Application - * Insights component daily data volumne cap + * @param {string} [webTestDefinition.kind] The kind of web test that this web + * test watches. Choices are ping and multistep. Possible values include: + * 'ping', 'multistep' * - * @param {number} [billingFeaturesProperties.dataVolumeCap.cap] Daily data - * volume cap in GB. + * @param {string} webTestDefinition.syntheticMonitorId Unique ID of this + * WebTest. This is typically the same value as the Name field. * - * @param {number} [billingFeaturesProperties.dataVolumeCap.warningThreshold] - * Reserved, not used for now. + * @param {string} webTestDefinition.webTestName User defined name if this + * WebTest. * - * @param {boolean} - * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitThreshold] - * Reserved, not used for now. + * @param {string} [webTestDefinition.description] Purpose/user defined + * descriptive test for this WebTest. * - * @param {boolean} - * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitCap] Do - * not send a notification email when the daily data volume cap is met. + * @param {boolean} [webTestDefinition.enabled] Is the test actively being + * monitored. * - * @param {array} [billingFeaturesProperties.currentBillingFeatures] Current - * enabled pricing plan. When the component is in the Enterprise plan, this - * will list both 'Basic' and 'Application Insights Enterprise'. + * @param {number} [webTestDefinition.frequency] Interval in seconds between + * test runs for this WebTest. Default value is 300. + * + * @param {number} [webTestDefinition.timeout] Seconds until this WebTest will + * timeout and fail. Default value is 30. + * + * @param {string} webTestDefinition.webTestKind The kind of web test this is, + * valid choices are ping and multistep. Possible values include: 'ping', + * 'multistep' + * + * @param {boolean} [webTestDefinition.retryEnabled] Allow for retries should + * this WebTest fail. + * + * @param {array} webTestDefinition.locations A list of where to physically run + * the tests from to give global coverage for accessibility of your + * application. + * + * @param {object} [webTestDefinition.configuration] An XML configuration + * specification for a WebTest. + * + * @param {string} [webTestDefinition.configuration.webTest] The XML + * specification of a WebTest to run against an application. + * + * @param {string} webTestDefinition.location Resource location + * + * @param {object} [webTestDefinition.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -1844,43 +3667,65 @@ export interface ComponentCurrentBillingFeatures { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update current billing features for an Application Insights component. + * Creates or updates an Application Insights web test definition. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * - * @param {object} billingFeaturesProperties Properties that need to be - * specified to update billing features for an Application Insights component. + * @param {object} webTestDefinition Properties that need to be specified to + * create or update an Application Insights web test definition. + * + * @param {string} [webTestDefinition.kind] The kind of web test that this web + * test watches. Choices are ping and multistep. Possible values include: + * 'ping', 'multistep' + * + * @param {string} webTestDefinition.syntheticMonitorId Unique ID of this + * WebTest. This is typically the same value as the Name field. + * + * @param {string} webTestDefinition.webTestName User defined name if this + * WebTest. + * + * @param {string} [webTestDefinition.description] Purpose/user defined + * descriptive test for this WebTest. + * + * @param {boolean} [webTestDefinition.enabled] Is the test actively being + * monitored. + * + * @param {number} [webTestDefinition.frequency] Interval in seconds between + * test runs for this WebTest. Default value is 300. + * + * @param {number} [webTestDefinition.timeout] Seconds until this WebTest will + * timeout and fail. Default value is 30. + * + * @param {string} webTestDefinition.webTestKind The kind of web test this is, + * valid choices are ping and multistep. Possible values include: 'ping', + * 'multistep' * - * @param {object} [billingFeaturesProperties.dataVolumeCap] An Application - * Insights component daily data volumne cap + * @param {boolean} [webTestDefinition.retryEnabled] Allow for retries should + * this WebTest fail. * - * @param {number} [billingFeaturesProperties.dataVolumeCap.cap] Daily data - * volume cap in GB. + * @param {array} webTestDefinition.locations A list of where to physically run + * the tests from to give global coverage for accessibility of your + * application. * - * @param {number} [billingFeaturesProperties.dataVolumeCap.warningThreshold] - * Reserved, not used for now. + * @param {object} [webTestDefinition.configuration] An XML configuration + * specification for a WebTest. * - * @param {boolean} - * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitThreshold] - * Reserved, not used for now. + * @param {string} [webTestDefinition.configuration.webTest] The XML + * specification of a WebTest to run against an application. * - * @param {boolean} - * [billingFeaturesProperties.dataVolumeCap.stopSendNotificationWhenHitCap] Do - * not send a notification email when the daily data volume cap is met. + * @param {string} webTestDefinition.location Resource location * - * @param {array} [billingFeaturesProperties.currentBillingFeatures] Current - * enabled pricing plan. When the component is in the Enterprise plan, this - * will list both 'Basic' and 'Application Insights Enterprise'. + * @param {object} [webTestDefinition.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -1894,7 +3739,7 @@ export interface ComponentCurrentBillingFeatures { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentBillingFeatures} - The deserialized result object. + * @resolve {WebTest} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1902,37 +3747,31 @@ export interface ComponentCurrentBillingFeatures { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentBillingFeatures} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentBillingFeatures} - * for more information. + * {WebTest} [result] - The deserialized result object if an error did not occur. + * See {@link WebTest} 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, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, callback: ServiceCallback): void; - update(resourceGroupName: string, resourceName: string, billingFeaturesProperties: models.ApplicationInsightsComponentBillingFeatures, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ComponentQuotaStatus - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApplicationInsightsManagementClient. - */ -export interface ComponentQuotaStatus { + createOrUpdate(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, webTestName: string, webTestDefinition: models.WebTest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns daily data volume cap (quota) status for an Application Insights - * component. + * Creates or updates an Application Insights web test definition. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * + * @param {object} webTestTags Updated tag information to set into the web test + * instance. + * + * @param {object} [webTestTags.tags] Resource tags + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1940,21 +3779,25 @@ export interface ComponentQuotaStatus { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateTagsWithHttpOperationResponse(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns daily data volume cap (quota) status for an Application Insights - * component. + * Creates or updates an Application Insights web test definition. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * + * @param {object} webTestTags Updated tag information to set into the web test + * instance. + * + * @param {object} [webTestTags.tags] Resource tags + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1967,7 +3810,7 @@ export interface ComponentQuotaStatus { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentQuotaStatus} - The deserialized result object. + * @resolve {WebTest} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1975,34 +3818,24 @@ export interface ComponentQuotaStatus { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentQuotaStatus} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentQuotaStatus} for - * more information. + * {WebTest} [result] - The deserialized result object if an error did not occur. + * See {@link WebTest} 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, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * APIKeys - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApplicationInsightsManagementClient. - */ -export interface APIKeys { + updateTags(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, webTestName: string, webTestTags: models.TagsResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of API keys of an Application Insights component. + * Deletes an Application Insights web test. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * * @param {object} [options] Optional Parameters. @@ -2012,18 +3845,18 @@ export interface APIKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of API keys of an Application Insights component. + * Deletes an Application Insights web test. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} resourceName The name of the Application Insights component + * @param {string} webTestName The name of the Application Insights webtest * resource. * * @param {object} [options] Optional Parameters. @@ -2038,7 +3871,7 @@ export interface APIKeys { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentAPIKeyListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2046,38 +3879,20 @@ export interface APIKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentAPIKeyListResult} [result] - The deserialized result object if an error did not occur. - * See {@link - * ApplicationInsightsComponentAPIKeyListResult} for more - * information. + * {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. */ - list(resourceGroupName: string, resourceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, resourceName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, resourceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, webTestName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, webTestName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, webTestName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create an API Key of an Application Insights component. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} resourceName The name of the Application Insights component - * resource. - * - * @param {object} aPIKeyProperties Properties that need to be specified to - * create an API key of a Application Insights component. - * - * @param {string} [aPIKeyProperties.name] The name of the API Key. - * - * @param {array} [aPIKeyProperties.linkedReadProperties] The read access - * rights of this API Key. - * - * @param {array} [aPIKeyProperties.linkedWriteProperties] The write access - * rights of this API Key. + * Get all Application Insights web test alerts definitioned within a + * subscription. * * @param {object} [options] Optional Parameters. * @@ -2086,30 +3901,15 @@ export interface APIKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create an API Key of an Application Insights component. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} resourceName The name of the Application Insights component - * resource. - * - * @param {object} aPIKeyProperties Properties that need to be specified to - * create an API key of a Application Insights component. - * - * @param {string} [aPIKeyProperties.name] The name of the API Key. - * - * @param {array} [aPIKeyProperties.linkedReadProperties] The read access - * rights of this API Key. - * - * @param {array} [aPIKeyProperties.linkedWriteProperties] The write access - * rights of this API Key. + * Get all Application Insights web test alerts definitioned within a + * subscription. * * @param {object} [options] Optional Parameters. * @@ -2123,7 +3923,7 @@ export interface APIKeys { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentAPIKey} - The deserialized result object. + * @resolve {WebTestListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2131,29 +3931,24 @@ export interface APIKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentAPIKey} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentAPIKey} for more - * information. + * {WebTestListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebTestListResult} 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. */ - create(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, callback: ServiceCallback): void; - create(resourceGroupName: string, resourceName: string, aPIKeyProperties: models.APIKeyRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete an API Key of an Application Insights component. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} resourceName The name of the Application Insights component - * resource. + * Get all Application Insights web tests defined within a specified resource + * group. * - * @param {string} keyId The API Key ID. This is unique within a Application - * Insights component. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2162,22 +3957,18 @@ export interface APIKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete an API Key of an Application Insights component. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} resourceName The name of the Application Insights component - * resource. + * Get all Application Insights web tests defined within a specified resource + * group. * - * @param {string} keyId The API Key ID. This is unique within a Application - * Insights component. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2191,7 +3982,7 @@ export interface APIKeys { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentAPIKey} - The deserialized result object. + * @resolve {WebTestListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2199,29 +3990,24 @@ export interface APIKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentAPIKey} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentAPIKey} for more - * information. + * {WebTestListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebTestListResult} 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. */ - deleteMethod(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, resourceName: string, keyId: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, resourceName: string, keyId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; /** - * Get the API Key for this key id. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} resourceName The name of the Application Insights component - * resource. + * Get all Application Insights web test alerts definitioned within a + * subscription. * - * @param {string} keyId The API Key ID. This is unique within a Application - * Insights component. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2230,22 +4016,18 @@ export interface APIKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get the API Key for this key id. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} resourceName The name of the Application Insights component - * resource. + * Get all Application Insights web test alerts definitioned within a + * subscription. * - * @param {string} keyId The API Key ID. This is unique within a Application - * Insights component. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2259,7 +4041,7 @@ export interface APIKeys { * * {Promise} A promise is returned. * - * @resolve {ApplicationInsightsComponentAPIKey} - The deserialized result object. + * @resolve {WebTestListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2267,15 +4049,14 @@ export interface APIKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApplicationInsightsComponentAPIKey} [result] - The deserialized result object if an error did not occur. - * See {@link ApplicationInsightsComponentAPIKey} for more - * information. + * {WebTestListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebTestListResult} 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, resourceName: string, keyId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, resourceName: string, keyId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, keyId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + 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; } diff --git a/lib/services/applicationinsights/lib/operations/index.js b/lib/services/applicationinsights/lib/operations/index.js index 6343fdcaac..d3bf3ca0f4 100644 --- a/lib/services/applicationinsights/lib/operations/index.js +++ b/lib/services/applicationinsights/lib/operations/index.js @@ -15,9 +15,17 @@ 'use strict'; exports.Operations = require('./operations'); -exports.Components = require('./components'); -exports.WebTests = require('./webTests'); +exports.Annotations = require('./annotations'); +exports.APIKeys = require('./aPIKeys'); exports.ExportConfigurations = require('./exportConfigurations'); exports.ComponentCurrentBillingFeatures = require('./componentCurrentBillingFeatures'); exports.ComponentQuotaStatus = require('./componentQuotaStatus'); -exports.APIKeys = require('./aPIKeys'); +exports.ComponentFeatureCapabilities = require('./componentFeatureCapabilities'); +exports.ComponentAvailableFeatures = require('./componentAvailableFeatures'); +exports.ProactiveDetectionConfigurations = require('./proactiveDetectionConfigurations'); +exports.Components = require('./components'); +exports.WorkItemConfigurations = require('./workItemConfigurations'); +exports.Favorites = require('./favorites'); +exports.Favorite = require('./favorite'); +exports.WebTestLocations = require('./webTestLocations'); +exports.WebTests = require('./webTests'); diff --git a/lib/services/applicationinsights/lib/operations/operations.js b/lib/services/applicationinsights/lib/operations/operations.js index fc9e0ae6bd..4647867740 100644 --- a/lib/services/applicationinsights/lib/operations/operations.js +++ b/lib/services/applicationinsights/lib/operations/operations.js @@ -59,7 +59,7 @@ function _list(options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/microsoft.insights/operations'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Insights/operations'; let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { diff --git a/lib/services/applicationinsights/lib/operations/proactiveDetectionConfigurations.js b/lib/services/applicationinsights/lib/operations/proactiveDetectionConfigurations.js new file mode 100644 index 0000000000..ab34c6bfd4 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/proactiveDetectionConfigurations.js @@ -0,0 +1,950 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 a list of ProactiveDetection configurations of an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + * + * {array} [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 _list(resourceGroupName, resourceName, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName 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/components/{resourceName}/ProactiveDetectionConfigs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationInsightsComponentProactiveDetectionConfigurationElementType', + type: { + name: 'Composite', + className: 'ApplicationInsightsComponentProactiveDetectionConfiguration' + } + } + } + }; + 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 the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @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 + * ApplicationInsightsComponentProactiveDetectionConfiguration} + * for more information. + * + * {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, resourceName, configurationId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (configurationId === null || configurationId === undefined || typeof configurationId.valueOf() !== 'string') { + throw new Error('configurationId 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/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{ConfigurationId}', encodeURIComponent(configurationId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ApplicationInsightsComponentProactiveDetectionConfiguration']().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 the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} proactiveDetectionProperties Properties that need to be + * specified to update the ProactiveDetection configuration. + * + * @param {string} [proactiveDetectionProperties.name] The rule name + * + * @param {boolean} [proactiveDetectionProperties.enabled] A flag that + * indicates whether this rule is enabled by the user + * + * @param {boolean} + * [proactiveDetectionProperties.sendEmailsToSubscriptionOwners] A flag that + * indicated whether notifications on this rule should be sent to subscription + * owners + * + * @param {array} [proactiveDetectionProperties.customEmails] Custom email + * addresses for this rule notifications + * + * @param {string} [proactiveDetectionProperties.lastUpdatedTime] The last time + * this rule was updated + * + * @param {object} [proactiveDetectionProperties.ruleDefinitions] Static + * definitions of the ProactiveDetection configuration rule (same values for + * all components). + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.name] The rule + * name + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.displayName] + * The rule name as it is displayed in UI + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.description] + * The rule description + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.helpUrl] URL + * which displays aditional info about the proactive detection rule + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isHidden] A + * flag indicating whether the rule is hidden (from the UI) + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.isEnabledByDefault] A flag + * indicating whether the rule is enabled by default + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isInPreview] + * A flag indicating whether the rule is in preview + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.supportsEmailNotifications] A + * flag indicating whether email notifications are supported for detections for + * this 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 + * ApplicationInsightsComponentProactiveDetectionConfiguration} + * for more information. + * + * {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, resourceName, configurationId, proactiveDetectionProperties, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (configurationId === null || configurationId === undefined || typeof configurationId.valueOf() !== 'string') { + throw new Error('configurationId cannot be null or undefined and it must be of type string.'); + } + if (proactiveDetectionProperties === null || proactiveDetectionProperties === undefined) { + throw new Error('proactiveDetectionProperties 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/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{ConfigurationId}', encodeURIComponent(configurationId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (proactiveDetectionProperties !== null && proactiveDetectionProperties !== undefined) { + let requestModelMapper = new client.models['ApplicationInsightsComponentProactiveDetectionConfiguration']().mapper(); + requestModel = client.serialize(requestModelMapper, proactiveDetectionProperties, 'proactiveDetectionProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(proactiveDetectionProperties, 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['ApplicationInsightsComponentProactiveDetectionConfiguration']().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 ProactiveDetectionConfigurations. */ +class ProactiveDetectionConfigurations { + /** + * Create a ProactiveDetectionConfigurations. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._update = _update; + } + + /** + * Gets a list of ProactiveDetection configurations of an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, resourceName, 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 ProactiveDetection configurations of an Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {Array} - 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. + * + * {array} [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. + */ + list(resourceGroupName, resourceName, 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, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, resourceName, options, optionalCallback); + } + } + + /** + * Get the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, configurationId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, resourceName, configurationId, 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 ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @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 {ApplicationInsightsComponentProactiveDetectionConfiguration} - 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 + * ApplicationInsightsComponentProactiveDetectionConfiguration} + * for more information. + * + * {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, resourceName, configurationId, 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, resourceName, configurationId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, resourceName, configurationId, options, optionalCallback); + } + } + + /** + * Update the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} proactiveDetectionProperties Properties that need to be + * specified to update the ProactiveDetection configuration. + * + * @param {string} [proactiveDetectionProperties.name] The rule name + * + * @param {boolean} [proactiveDetectionProperties.enabled] A flag that + * indicates whether this rule is enabled by the user + * + * @param {boolean} + * [proactiveDetectionProperties.sendEmailsToSubscriptionOwners] A flag that + * indicated whether notifications on this rule should be sent to subscription + * owners + * + * @param {array} [proactiveDetectionProperties.customEmails] Custom email + * addresses for this rule notifications + * + * @param {string} [proactiveDetectionProperties.lastUpdatedTime] The last time + * this rule was updated + * + * @param {object} [proactiveDetectionProperties.ruleDefinitions] Static + * definitions of the ProactiveDetection configuration rule (same values for + * all components). + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.name] The rule + * name + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.displayName] + * The rule name as it is displayed in UI + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.description] + * The rule description + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.helpUrl] URL + * which displays aditional info about the proactive detection rule + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isHidden] A + * flag indicating whether the rule is hidden (from the UI) + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.isEnabledByDefault] A flag + * indicating whether the rule is enabled by default + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isInPreview] + * A flag indicating whether the rule is in preview + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.supportsEmailNotifications] A + * flag indicating whether email notifications are supported for detections for + * this 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. + */ + updateWithHttpOperationResponse(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the ProactiveDetection configuration for this configuration id. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} configurationId The ProactiveDetection configuration ID. + * This is unique within a Application Insights component. + * + * @param {object} proactiveDetectionProperties Properties that need to be + * specified to update the ProactiveDetection configuration. + * + * @param {string} [proactiveDetectionProperties.name] The rule name + * + * @param {boolean} [proactiveDetectionProperties.enabled] A flag that + * indicates whether this rule is enabled by the user + * + * @param {boolean} + * [proactiveDetectionProperties.sendEmailsToSubscriptionOwners] A flag that + * indicated whether notifications on this rule should be sent to subscription + * owners + * + * @param {array} [proactiveDetectionProperties.customEmails] Custom email + * addresses for this rule notifications + * + * @param {string} [proactiveDetectionProperties.lastUpdatedTime] The last time + * this rule was updated + * + * @param {object} [proactiveDetectionProperties.ruleDefinitions] Static + * definitions of the ProactiveDetection configuration rule (same values for + * all components). + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.name] The rule + * name + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.displayName] + * The rule name as it is displayed in UI + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.description] + * The rule description + * + * @param {string} [proactiveDetectionProperties.ruleDefinitions.helpUrl] URL + * which displays aditional info about the proactive detection rule + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isHidden] A + * flag indicating whether the rule is hidden (from the UI) + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.isEnabledByDefault] A flag + * indicating whether the rule is enabled by default + * + * @param {boolean} [proactiveDetectionProperties.ruleDefinitions.isInPreview] + * A flag indicating whether the rule is in preview + * + * @param {boolean} + * [proactiveDetectionProperties.ruleDefinitions.supportsEmailNotifications] A + * flag indicating whether email notifications are supported for detections for + * this 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 {ApplicationInsightsComponentProactiveDetectionConfiguration} - 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 + * ApplicationInsightsComponentProactiveDetectionConfiguration} + * for more information. + * + * {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, resourceName, configurationId, proactiveDetectionProperties, 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, resourceName, configurationId, proactiveDetectionProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties, options, optionalCallback); + } + } + +} + +module.exports = ProactiveDetectionConfigurations; diff --git a/lib/services/applicationinsights/lib/operations/webTestLocations.js b/lib/services/applicationinsights/lib/operations/webTestLocations.js new file mode 100644 index 0000000000..c89e7dd3f0 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/webTestLocations.js @@ -0,0 +1,271 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 a list of web test locations available to this Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 + * ApplicationInsightsWebTestLocationsListResult} for more + * information. + * + * {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, resourceName, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName 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/components/{resourceName}/syntheticmonitorlocations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ApplicationInsightsWebTestLocationsListResult']().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 WebTestLocations. */ +class WebTestLocations { + /** + * Create a WebTestLocations. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Gets a list of web test locations available to this Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, resourceName, 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 web test locations available to this Application Insights + * component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {ApplicationInsightsWebTestLocationsListResult} - 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 + * ApplicationInsightsWebTestLocationsListResult} for more + * information. + * + * {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, resourceName, 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, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, resourceName, options, optionalCallback); + } + } + +} + +module.exports = WebTestLocations; diff --git a/lib/services/applicationinsights/lib/operations/webTests.js b/lib/services/applicationinsights/lib/operations/webTests.js index 4d7271d4af..7f9a557bdf 100644 --- a/lib/services/applicationinsights/lib/operations/webTests.js +++ b/lib/services/applicationinsights/lib/operations/webTests.js @@ -68,7 +68,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; @@ -213,7 +213,7 @@ function _get(resourceGroupName, webTestName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{webTestName}', encodeURIComponent(webTestName)); @@ -408,7 +408,7 @@ function _createOrUpdate(resourceGroupName, webTestName, webTestDefinition, opti // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{webTestName}', encodeURIComponent(webTestName)); @@ -576,7 +576,7 @@ function _updateTags(resourceGroupName, webTestName, webTestTags, options, callb // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{webTestName}', encodeURIComponent(webTestName)); @@ -735,7 +735,7 @@ function _deleteMethod(resourceGroupName, webTestName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/webtests/{webTestName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{webTestName}', encodeURIComponent(webTestName)); @@ -772,7 +772,7 @@ function _deleteMethod(resourceGroupName, webTestName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -854,7 +854,7 @@ function _list(options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/microsoft.insights/webtests'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); diff --git a/lib/services/applicationinsights/lib/operations/workItemConfigurations.js b/lib/services/applicationinsights/lib/operations/workItemConfigurations.js new file mode 100644 index 0000000000..12cf0121a1 --- /dev/null +++ b/lib/services/applicationinsights/lib/operations/workItemConfigurations.js @@ -0,0 +1,1067 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code 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 list work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + * + * {array} [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 _list(resourceGroupName, resourceName, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName 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/components/{resourceName}/WorkItemConfigs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['WorkItemConfigurationError']().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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WorkItemConfigurationElementType', + type: { + name: 'Composite', + className: 'WorkItemConfiguration' + } + } + } + }; + 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 a work item configuration for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} workItemConfigurationProperties Properties that need to be + * specified to create a work item configuration of a Application Insights + * component. + * + * @param {string} [workItemConfigurationProperties.connectorId] Unique + * connector id + * + * @param {string} [workItemConfigurationProperties.connectorDataConfiguration] + * Serialized JSON object for detaile d properties + * + * @param {boolean} [workItemConfigurationProperties.validateOnly] Boolean + * indicating validate only + * + * @param {string} [workItemConfigurationProperties.workItemProperties] Custom + * work item properties + * + * @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 WorkItemConfiguration} for more information. + * + * {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 _create(resourceGroupName, resourceName, workItemConfigurationProperties, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (workItemConfigurationProperties === null || workItemConfigurationProperties === undefined) { + throw new Error('workItemConfigurationProperties 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/components/{resourceName}/WorkItemConfigs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (workItemConfigurationProperties !== null && workItemConfigurationProperties !== undefined) { + let requestModelMapper = new client.models['WorkItemCreateConfiguration']().mapper(); + requestModel = client.serialize(requestModelMapper, workItemConfigurationProperties, 'workItemConfigurationProperties'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(workItemConfigurationProperties, 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['WorkItemConfiguration']().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 default work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 WorkItemConfiguration} for more information. + * + * {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 _getDefault(resourceGroupName, resourceName, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName 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/components/{resourceName}/DefaultWorkItemConfig'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['WorkItemConfiguration']().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 workitem configuration of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} workItemConfigId The unique work item configuration Id. This + * can be either friendly name of connector as defined in connector + * configuration + * + * @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. + * + * {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, resourceName, workItemConfigId, 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 (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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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 (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { + throw new Error('resourceName cannot be null or undefined and it must be of type string.'); + } + if (workItemConfigId === null || workItemConfigId === undefined || typeof workItemConfigId.valueOf() !== 'string') { + throw new Error('workItemConfigId 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/components/{resourceName}/WorkItemConfigs/{workItemConfigId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); + requestUrl = requestUrl.replace('{workItemConfigId}', encodeURIComponent(workItemConfigId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Object' + } + }; + 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 WorkItemConfigurations. */ +class WorkItemConfigurations { + /** + * Create a WorkItemConfigurations. + * @param {ApplicationInsightsManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._create = _create; + this._getDefault = _getDefault; + this._deleteMethod = _deleteMethod; + } + + /** + * Gets the list work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, resourceName, 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 list work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {Array} - 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. + * + * {array} [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. + */ + list(resourceGroupName, resourceName, 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, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, resourceName, options, optionalCallback); + } + } + + /** + * Create a work item configuration for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} workItemConfigurationProperties Properties that need to be + * specified to create a work item configuration of a Application Insights + * component. + * + * @param {string} [workItemConfigurationProperties.connectorId] Unique + * connector id + * + * @param {string} [workItemConfigurationProperties.connectorDataConfiguration] + * Serialized JSON object for detaile d properties + * + * @param {boolean} [workItemConfigurationProperties.validateOnly] Boolean + * indicating validate only + * + * @param {string} [workItemConfigurationProperties.workItemProperties] Custom + * work item properties + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName, resourceName, workItemConfigurationProperties, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, resourceName, workItemConfigurationProperties, 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 work item configuration for an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {object} workItemConfigurationProperties Properties that need to be + * specified to create a work item configuration of a Application Insights + * component. + * + * @param {string} [workItemConfigurationProperties.connectorId] Unique + * connector id + * + * @param {string} [workItemConfigurationProperties.connectorDataConfiguration] + * Serialized JSON object for detaile d properties + * + * @param {boolean} [workItemConfigurationProperties.validateOnly] Boolean + * indicating validate only + * + * @param {string} [workItemConfigurationProperties.workItemProperties] Custom + * work item properties + * + * @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 {WorkItemConfiguration} - 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 WorkItemConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, resourceName, workItemConfigurationProperties, 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._create(resourceGroupName, resourceName, workItemConfigurationProperties, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, resourceName, workItemConfigurationProperties, options, optionalCallback); + } + } + + /** + * Gets default work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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. + */ + getDefaultWithHttpOperationResponse(resourceGroupName, resourceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getDefault(resourceGroupName, resourceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets default work item configurations that exist for the application + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * 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 {WorkItemConfiguration} - 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 WorkItemConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getDefault(resourceGroupName, resourceName, 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._getDefault(resourceGroupName, resourceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getDefault(resourceGroupName, resourceName, options, optionalCallback); + } + } + + /** + * Delete an workitem configuration of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} workItemConfigId The unique work item configuration Id. This + * can be either friendly name of connector as defined in connector + * configuration + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, resourceName, workItemConfigId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, resourceName, workItemConfigId, 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 workitem configuration of an Application Insights component. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} resourceName The name of the Application Insights component + * resource. + * + * @param {string} workItemConfigId The unique work item configuration Id. This + * can be either friendly name of connector as defined in connector + * configuration + * + * @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 {Object} - 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. + * + * {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, resourceName, workItemConfigId, 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, resourceName, workItemConfigId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, resourceName, workItemConfigId, options, optionalCallback); + } + } + +} + +module.exports = WorkItemConfigurations; diff --git a/lib/services/applicationinsights/package.json b/lib/services/applicationinsights/package.json index 09cda73847..7025e7a746 100644 --- a/lib/services/applicationinsights/package.json +++ b/lib/services/applicationinsights/package.json @@ -1,35 +1,22 @@ { "name": "azure-arm-appinsights", "author": "Microsoft Corporation", - "contributors": [ - "Zavery, Amar " - ], - "version": "1.1.0-preview", - "description": "Microsoft Azure Application Insights Management Client Library for node", - "tags": [ - "azure", - "sdk" - ], - "keywords": [ - "node", - "azure" - ], - "main": "./lib/applicationInsightsManagementClient.js", - "types": "./lib/applicationInsightsManagementClient.d.ts", - "license": "MIT", + "description": "ApplicationInsightsManagementClient Library with typescript type definitions for node", + "version": "1.2.0-preview", "dependencies": { - "ms-rest": "^2.2.2", - "ms-rest-azure": "^2.3.3" + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/applicationInsightsManagementClient.js", + "types": "./lib/applicationInsightsManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", - "url": "https://github.com:Azure/azure-sdk-for-node.git" + "url": "https://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 +}