This repository was archived by the owner on May 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 557
Adding App Insights data plane client #3021
Closed
Closed
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5375c51
Add App Insights client, rollup, changelog
alexeldeib d5d7d0c
add package mapping
alexeldeib 7fc9bba
de-bump version, initial example in readme
1f3aaf7
initial testing
alexeldeib aa6e3ca
readme descriptions
alexeldeib c6e7d83
adding tests
alexeldeib ccadf86
update event tests
alexeldeib 184b734
cleanup, remove XML, update version, regen
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| The MIT License (MIT) | ||
|
|
||
| Copyright (c) 2018 Microsoft | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| uid: azure-applicationinsights | ||
| summary: *content | ||
|
|
||
| --- | ||
| # Microsoft Azure SDK for Node.js - ApplicationInsightsDataClient | ||
| This project provides a Node.js package for accessing Azure. Right now it supports: | ||
| - **Node.js version 6.x.x or higher** | ||
|
|
||
| ## Features | ||
|
|
||
|
|
||
| ## How to Install | ||
|
|
||
| ```bash | ||
| npm install azure-applicationinsights | ||
| ``` | ||
|
|
||
| ## How to use | ||
|
|
||
| ### Authentication, client creation and get metrics as an example. | ||
|
|
||
| ```javascript | ||
| const msRest = require("ms-rest"); | ||
| const ApplicationInsightsDataClient = require("azure-applicationinsights"); | ||
| const token = "<access_token>"; | ||
| const creds = new msRest.TokenCredentials(token); | ||
| const subscriptionId = "<Subscription_Id>"; | ||
| const client = new ApplicationInsightsDataClient(creds, subscriptionId); | ||
| const appId = "testappId"; | ||
| const metricId = "requests/count"; | ||
| const timespan = "testtimespan"; | ||
| const interval = "P1Y2M3DT4H5M6S"; | ||
| const aggregation = ["min"]; | ||
| const segment = ["applicationBuild"]; | ||
| const top = 1; | ||
| const orderby = "testorderby"; | ||
| const filter = "testfilter"; | ||
| client.metrics.get(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter).then((result) => { | ||
| console.log("The result is:"); | ||
| console.log(result); | ||
| }).catch((err) => { | ||
| console.log('An error occurred:'); | ||
| console.dir(err, {depth: null, colors: true}); | ||
| }); | ||
|
|
||
| ## Related projects | ||
|
|
||
| - [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) | ||
45 changes: 45 additions & 0 deletions
45
lib/services/applicationinsightsClient/lib/applicationInsightsDataClient.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for | ||
| * license information. | ||
| * | ||
| * Code generated by Microsoft (R) AutoRest Code Generator. | ||
| * Changes may cause incorrect behavior and will be lost if the code is | ||
| * regenerated. | ||
| */ | ||
|
|
||
| import { ServiceClient, ServiceClientOptions, ServiceClientCredentials } from 'ms-rest'; | ||
| import * as models from "./models"; | ||
| import * as operations from "./operations"; | ||
|
|
||
| export default class ApplicationInsightsDataClient extends ServiceClient { | ||
| /** | ||
| * @class | ||
| * Initializes a new instance of the ApplicationInsightsDataClient class. | ||
| * @constructor | ||
| * | ||
| * @param {credentials} credentials - Subscription credentials which uniquely identify client subscription. | ||
| * | ||
| * @param {string} [baseUri] - The base URI of the service. | ||
| * | ||
| * @param {object} [options] - The parameter options | ||
| * | ||
| * @param {Array} [options.filters] - Filters to be added to the request pipeline | ||
| * | ||
| * @param {object} [options.requestOptions] - Options for the underlying request object | ||
| * {@link https://github.com/request/request#requestoptions-callback Options doc} | ||
| * | ||
| * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy | ||
| * | ||
| */ | ||
| constructor(credentials: ServiceClientCredentials, baseUri?: string, options?: ServiceClientOptions); | ||
|
|
||
| credentials: ServiceClientCredentials; | ||
|
|
||
| // Operation groups | ||
| metrics: operations.Metrics; | ||
| events: operations.Events; | ||
| query: operations.Query; | ||
| } | ||
|
|
||
| export { ApplicationInsightsDataClient, models as ApplicationInsightsDataModels }; |
65 changes: 65 additions & 0 deletions
65
lib/services/applicationinsightsClient/lib/applicationInsightsDataClient.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for | ||
| * license information. | ||
| * | ||
| * Code generated by Microsoft (R) AutoRest Code Generator. | ||
| * Changes may cause incorrect behavior and will be lost if the code is | ||
| * regenerated. | ||
| */ | ||
|
|
||
| /* jshint latedef:false */ | ||
| /* jshint forin:false */ | ||
| /* jshint noempty:false */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| const msRest = require('ms-rest'); | ||
| const ServiceClient = msRest.ServiceClient; | ||
|
|
||
| const models = require('./models'); | ||
| const operations = require('./operations'); | ||
|
|
||
|
|
||
| /** Class representing a ApplicationInsightsDataClient. */ | ||
| class ApplicationInsightsDataClient extends ServiceClient { | ||
| /** | ||
| * Create a ApplicationInsightsDataClient. | ||
| * @param {credentials} credentials - Subscription credentials which uniquely identify client subscription. | ||
| * @param {string} [baseUri] - The base URI of the service. | ||
| * @param {object} [options] - The parameter options | ||
| * @param {Array} [options.filters] - Filters to be added to the request pipeline | ||
| * @param {object} [options.requestOptions] - Options for the underlying request object | ||
| * {@link https://github.com/request/request#requestoptions-callback Options doc} | ||
| * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy | ||
| */ | ||
| constructor(credentials, baseUri, options) { | ||
| if (credentials === null || credentials === undefined) { | ||
| throw new Error('\'credentials\' cannot be null.'); | ||
| } | ||
|
|
||
| if (!options) options = {}; | ||
|
|
||
| super(credentials, options); | ||
|
|
||
| this.baseUri = baseUri; | ||
| if (!this.baseUri) { | ||
| this.baseUri = 'https://api.applicationinsights.io/v1'; | ||
| } | ||
| this.credentials = credentials; | ||
|
|
||
| let packageInfo = this.getPackageJsonInfo(__dirname); | ||
| this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); | ||
| this.metrics = new operations.Metrics(this); | ||
| this.events = new operations.Events(this); | ||
| this.query = new operations.Query(this); | ||
| this.models = models; | ||
| msRest.addSerializationMixin(this); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| module.exports = ApplicationInsightsDataClient; | ||
| module.exports['default'] = ApplicationInsightsDataClient; | ||
| module.exports.ApplicationInsightsDataClient = ApplicationInsightsDataClient; | ||
| module.exports.ApplicationInsightsDataModels = models; |
62 changes: 62 additions & 0 deletions
62
lib/services/applicationinsightsClient/lib/models/column.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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'; | ||
|
|
||
| /** | ||
| * @summary A table column. | ||
| * | ||
| * A column in a table. | ||
| * | ||
| */ | ||
| class Column { | ||
| /** | ||
| * Create a Column. | ||
| * @member {string} [name] The name of this column. | ||
| * @member {string} [type] The data type of this column. | ||
| */ | ||
| constructor() { | ||
| } | ||
|
|
||
| /** | ||
| * Defines the metadata of Column | ||
| * | ||
| * @returns {object} metadata of Column | ||
| * | ||
| */ | ||
| mapper() { | ||
| return { | ||
| required: false, | ||
| serializedName: 'column', | ||
| type: { | ||
| name: 'Composite', | ||
| className: 'Column', | ||
| modelProperties: { | ||
| name: { | ||
| required: false, | ||
| serializedName: 'name', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| }, | ||
| type: { | ||
| required: false, | ||
| serializedName: 'type', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| module.exports = Column; |
102 changes: 102 additions & 0 deletions
102
lib/services/applicationinsightsClient/lib/models/errorDetail.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for | ||
| * license information. | ||
| * | ||
| * Code generated by Microsoft (R) AutoRest Code Generator. | ||
| * Changes may cause incorrect behavior and will be lost if the code is | ||
| * regenerated. | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| /** | ||
| * @summary Error details. | ||
| * | ||
| */ | ||
| class ErrorDetail { | ||
| /** | ||
| * Create a ErrorDetail. | ||
| * @member {string} code The error's code. | ||
| * @member {string} message A human readable error message. | ||
| * @member {string} [target] Indicates which property in the request is | ||
| * responsible for the error. | ||
| * @member {string} [value] Indicates which value in 'target' is responsible | ||
| * for the error. | ||
| * @member {array} [resources] Indicates resources which were responsible for | ||
| * the error. | ||
| * @member {object} [additionalProperties] | ||
| */ | ||
| constructor() { | ||
| } | ||
|
|
||
| /** | ||
| * Defines the metadata of ErrorDetail | ||
| * | ||
| * @returns {object} metadata of ErrorDetail | ||
| * | ||
| */ | ||
| mapper() { | ||
| return { | ||
| required: false, | ||
| serializedName: 'errorDetail', | ||
| type: { | ||
| name: 'Composite', | ||
| className: 'ErrorDetail', | ||
| modelProperties: { | ||
| code: { | ||
| required: true, | ||
| serializedName: 'code', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| }, | ||
| message: { | ||
| required: true, | ||
| serializedName: 'message', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| }, | ||
| target: { | ||
| required: false, | ||
| serializedName: 'target', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| }, | ||
| value: { | ||
| required: false, | ||
| serializedName: 'value', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| }, | ||
| resources: { | ||
| required: false, | ||
| serializedName: 'resources', | ||
| type: { | ||
| name: 'Sequence', | ||
| element: { | ||
| required: false, | ||
| serializedName: 'StringElementType', | ||
| type: { | ||
| name: 'String' | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| additionalProperties: { | ||
| required: false, | ||
| serializedName: 'additionalProperties', | ||
| type: { | ||
| name: 'Object' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| module.exports = ErrorDetail; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From where would one get the access token. Please provide that info. Aren't customers suppose to use the standard msRestAzure.loginWithServicePrincipal(..) method for authentication?