diff --git a/sdk/applicationinsights/applicationinsights-query/LICENSE.txt b/sdk/applicationinsights/applicationinsights-query/LICENSE.txt new file mode 100644 index 000000000000..b73b4a1293c3 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/applicationinsights/applicationinsights-query/README.md b/sdk/applicationinsights/applicationinsights-query/README.md new file mode 100644 index 000000000000..4dc1b700d94a --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/README.md @@ -0,0 +1,112 @@ +## An isomorphic javascript sdk for - ApplicationInsightsDataClient + +This package contains an isomorphic SDK for ApplicationInsightsDataClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/applicationinsights-query +``` + +### How to use + +#### nodejs - Authentication, client creation and get metrics as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { ApplicationInsightsDataClient, ApplicationInsightsDataModels, ApplicationInsightsDataMappers } from "@azure/applicationinsights-query"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + 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.error(err); +}); +``` + +#### browser - Authentication, client creation and get metrics as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/applicationinsights-query sample + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/sdk/applicationinsights/applicationinsights-query/lib/applicationInsightsDataClient.ts b/sdk/applicationinsights/applicationinsights-query/lib/applicationInsightsDataClient.ts new file mode 100644 index 000000000000..df88350debaa --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/applicationInsightsDataClient.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { ApplicationInsightsDataClientContext } from "./applicationInsightsDataClientContext"; + +class ApplicationInsightsDataClient extends ApplicationInsightsDataClientContext { + // Operation groups + metrics: operations.Metrics; + events: operations.Events; + query: operations.Query; + + /** + * Initializes a new instance of the ApplicationInsightsDataClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.ApplicationInsightsDataClientOptions) { + super(credentials, options); + this.metrics = new operations.Metrics(this); + this.events = new operations.Events(this); + this.query = new operations.Query(this); + } +} + +// Operation Specifications + +export { + ApplicationInsightsDataClient, + ApplicationInsightsDataClientContext, + Models as ApplicationInsightsDataModels, + Mappers as ApplicationInsightsDataMappers +}; +export * from "./operations"; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/applicationInsightsDataClientContext.ts b/sdk/applicationinsights/applicationinsights-query/lib/applicationInsightsDataClientContext.ts new file mode 100644 index 000000000000..e82432c7db89 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/applicationInsightsDataClientContext.ts @@ -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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; + +const packageName = "@azure/applicationinsights-query"; +const packageVersion = "1.1.0"; + +export class ApplicationInsightsDataClientContext extends msRest.ServiceClient { + credentials: msRest.ServiceClientCredentials; + + /** + * Initializes a new instance of the ApplicationInsightsDataClientContext class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, options?: Models.ApplicationInsightsDataClientOptions) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRest.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.baseUri = options.baseUri || this.baseUri || "https://api.applicationinsights.io"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + + } +} diff --git a/sdk/applicationinsights/applicationinsights-query/lib/models/eventsMappers.ts b/sdk/applicationinsights/applicationinsights-query/lib/models/eventsMappers.ts new file mode 100644 index 000000000000..57883403a86f --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/models/eventsMappers.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + EventsResults, + ErrorInfo, + ErrorDetail, + EventsResultData, + EventsResultDataCustomDimensions, + EventsResultDataCustomMeasurements, + EventsOperationInfo, + EventsSessionInfo, + EventsUserInfo, + EventsCloudInfo, + EventsAiInfo, + EventsApplicationInfo, + EventsClientInfo, + ErrorResponse, + EventsTraceResult, + EventsTraceInfo, + EventsCustomEventResult, + EventsCustomEventInfo, + EventsPageViewResult, + EventsPageViewInfo, + EventsBrowserTimingResult, + EventsBrowserTimingInfo, + EventsClientPerformanceInfo, + EventsRequestResult, + EventsRequestInfo, + EventsDependencyResult, + EventsDependencyInfo, + EventsExceptionResult, + EventsExceptionInfo, + EventsExceptionDetail, + EventsExceptionDetailsParsedStack, + EventsAvailabilityResultResult, + EventsAvailabilityResultInfo, + EventsPerformanceCounterResult, + EventsPerformanceCounterInfo, + EventsCustomMetricResult, + EventsCustomMetricInfo +} from "../models/mappers"; + diff --git a/sdk/applicationinsights/applicationinsights-query/lib/models/index.ts b/sdk/applicationinsights/applicationinsights-query/lib/models/index.ts new file mode 100644 index 000000000000..551dd4c0dc05 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/models/index.ts @@ -0,0 +1,2085 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientOptions } from "@azure/ms-rest-js"; +import * as msRest from "@azure/ms-rest-js"; + + +/** + * @interface + * An interface representing MetricsPostBodySchemaParameters. + * The parameters for a single metrics query + * + */ +export interface MetricsPostBodySchemaParameters { + /** + * @member {MetricId} metricId Possible values include: 'requests/count', + * 'requests/duration', 'requests/failed', 'users/count', + * 'users/authenticated', 'pageViews/count', 'pageViews/duration', + * 'client/processingDuration', 'client/receiveDuration', + * 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', + * 'dependencies/count', 'dependencies/failed', 'dependencies/duration', + * 'exceptions/count', 'exceptions/browser', 'exceptions/server', + * 'sessions/count', 'performanceCounters/requestExecutionTime', + * 'performanceCounters/requestsPerSecond', + * 'performanceCounters/requestsInQueue', + * 'performanceCounters/memoryAvailableBytes', + * 'performanceCounters/exceptionsPerSecond', + * 'performanceCounters/processCpuPercentage', + * 'performanceCounters/processIOBytesPerSecond', + * 'performanceCounters/processPrivateBytes', + * 'performanceCounters/processorCpuPercentage', + * 'availabilityResults/availabilityPercentage', + * 'availabilityResults/duration', 'billing/telemetryCount', + * 'customEvents/count' + */ + metricId: MetricId; + /** + * @member {string} [timespan] + */ + timespan?: string; + /** + * @member {MetricsAggregation[]} [aggregation] + */ + aggregation?: MetricsAggregation[]; + /** + * @member {string} [interval] + */ + interval?: string; + /** + * @member {MetricsSegment[]} [segment] + */ + segment?: MetricsSegment[]; + /** + * @member {number} [top] + */ + top?: number; + /** + * @member {string} [orderby] + */ + orderby?: string; + /** + * @member {string} [filter] + */ + filter?: string; +} + +/** + * @interface + * An interface representing MetricsPostBodySchema. + * A metric request + * + */ +export interface MetricsPostBodySchema { + /** + * @member {string} id An identifier for this query. Must be unique within + * the post body of the request. This identifier will be the 'id' property + * of the response object representing this query. + */ + id: string; + /** + * @member {MetricsPostBodySchemaParameters} parameters The parameters for a + * single metrics query + */ + parameters: MetricsPostBodySchemaParameters; +} + +/** + * @interface + * An interface representing MetricsSegmentInfo. + * A metric segment + * + */ +export interface MetricsSegmentInfo { + /** + * @member {Date} [start] Start time of the metric segment (only when an + * interval was specified). + */ + start?: Date; + /** + * @member {Date} [end] Start time of the metric segment (only when an + * interval was specified). + */ + end?: Date; + /** + * @member {MetricsSegmentInfo[]} [segments] Segmented metric data (if + * further segmented). + */ + segments?: MetricsSegmentInfo[]; + /** + * @property Describes unknown properties. The value of an unknown property + * can be of "any" type. + */ + [property: string]: any; +} + +/** + * @interface + * An interface representing MetricsResultInfo. + * A metric result data. + * + */ +export interface MetricsResultInfo { + /** + * @member {Date} [start] Start time of the metric. + */ + start?: Date; + /** + * @member {Date} [end] Start time of the metric. + */ + end?: Date; + /** + * @member {string} [interval] The interval used to segment the metric data. + */ + interval?: string; + /** + * @member {MetricsSegmentInfo[]} [segments] Segmented metric data (if + * segmented). + */ + segments?: MetricsSegmentInfo[]; + /** + * @property Describes unknown properties. The value of an unknown property + * can be of "any" type. + */ + [property: string]: any; +} + +/** + * @interface + * An interface representing MetricsResult. + * A metric result. + * + */ +export interface MetricsResult { + /** + * @member {MetricsResultInfo} [value] + */ + value?: MetricsResultInfo; +} + +/** + * @interface + * An interface representing MetricsResultsItem. + */ +export interface MetricsResultsItem { + /** + * @member {string} id The specified ID for this metric. + */ + id: string; + /** + * @member {number} status The HTTP status code of this metric query. + */ + status: number; + /** + * @member {MetricsResult} body The results of this metric query. + */ + body: MetricsResult; +} + +/** + * @interface + * An interface representing ErrorDetail. + * @summary Error details. + * + */ +export interface ErrorDetail { + /** + * @member {string} code The error's code. + */ + code: string; + /** + * @member {string} message A human readable error message. + */ + message: string; + /** + * @member {string} [target] Indicates which property in the request is + * responsible for the error. + */ + target?: string; + /** + * @member {string} [value] Indicates which value in 'target' is responsible + * for the error. + */ + value?: string; + /** + * @member {string[]} [resources] Indicates resources which were responsible + * for the error. + */ + resources?: string[]; + /** + * @member {any} [additionalProperties] + */ + additionalProperties?: any; +} + +/** + * @interface + * An interface representing ErrorInfo. + * @summary The code and message for an error. + * + */ +export interface ErrorInfo { + /** + * @member {string} code A machine readable error code. + */ + code: string; + /** + * @member {string} message A human readable error message. + */ + message: string; + /** + * @member {ErrorDetail[]} [details] error details. + */ + details?: ErrorDetail[]; + /** + * @member {ErrorInfo} [innererror] Inner error details if they exist. + */ + innererror?: ErrorInfo; + /** + * @member {any} [additionalProperties] + */ + additionalProperties?: any; +} + +/** + * @interface + * An interface representing EventsResultDataCustomDimensions. + * Custom dimensions of the event + * + */ +export interface EventsResultDataCustomDimensions { + /** + * @member {any} [additionalProperties] + */ + additionalProperties?: any; +} + +/** + * @interface + * An interface representing EventsResultDataCustomMeasurements. + * Custom measurements of the event + * + */ +export interface EventsResultDataCustomMeasurements { + /** + * @member {any} [additionalProperties] + */ + additionalProperties?: any; +} + +/** + * @interface + * An interface representing EventsOperationInfo. + * Operation info for an event result + * + */ +export interface EventsOperationInfo { + /** + * @member {string} [name] Name of the operation + */ + name?: string; + /** + * @member {string} [id] ID of the operation + */ + id?: string; + /** + * @member {string} [parentId] Parent ID of the operation + */ + parentId?: string; + /** + * @member {string} [syntheticSource] Synthetic source of the operation + */ + syntheticSource?: string; +} + +/** + * @interface + * An interface representing EventsSessionInfo. + * Session info for an event result + * + */ +export interface EventsSessionInfo { + /** + * @member {string} [id] ID of the session + */ + id?: string; +} + +/** + * @interface + * An interface representing EventsUserInfo. + * User info for an event result + * + */ +export interface EventsUserInfo { + /** + * @member {string} [id] ID of the user + */ + id?: string; + /** + * @member {string} [accountId] Account ID of the user + */ + accountId?: string; + /** + * @member {string} [authenticatedId] Authenticated ID of the user + */ + authenticatedId?: string; +} + +/** + * @interface + * An interface representing EventsCloudInfo. + * Cloud info for an event result + * + */ +export interface EventsCloudInfo { + /** + * @member {string} [roleName] Role name of the cloud + */ + roleName?: string; + /** + * @member {string} [roleInstance] Role instance of the cloud + */ + roleInstance?: string; +} + +/** + * @interface + * An interface representing EventsAiInfo. + * AI related application info for an event result + * + */ +export interface EventsAiInfo { + /** + * @member {string} [iKey] iKey of the app + */ + iKey?: string; + /** + * @member {string} [appName] Name of the application + */ + appName?: string; + /** + * @member {string} [appId] ID of the application + */ + appId?: string; + /** + * @member {string} [sdkVersion] SDK version of the application + */ + sdkVersion?: string; +} + +/** + * @interface + * An interface representing EventsApplicationInfo. + * Application info for an event result + * + */ +export interface EventsApplicationInfo { + /** + * @member {string} [version] Version of the application + */ + version?: string; +} + +/** + * @interface + * An interface representing EventsClientInfo. + * Client info for an event result + * + */ +export interface EventsClientInfo { + /** + * @member {string} [model] Model of the client + */ + model?: string; + /** + * @member {string} [os] Operating system of the client + */ + os?: string; + /** + * @member {string} [type] Type of the client + */ + type?: string; + /** + * @member {string} [browser] Browser of the client + */ + browser?: string; + /** + * @member {string} [ip] IP address of the client + */ + ip?: string; + /** + * @member {string} [city] City of the client + */ + city?: string; + /** + * @member {string} [stateOrProvince] State or province of the client + */ + stateOrProvince?: string; + /** + * @member {string} [countryOrRegion] Country or region of the client + */ + countryOrRegion?: string; +} + +/** + * Contains the possible cases for EventsResultData. + */ +export type EventsResultDataUnion = EventsResultData | EventsTraceResult | EventsCustomEventResult | EventsPageViewResult | EventsBrowserTimingResult | EventsRequestResult | EventsDependencyResult | EventsExceptionResult | EventsAvailabilityResultResult | EventsPerformanceCounterResult | EventsCustomMetricResult; + +/** + * @interface + * An interface representing EventsResultData. + * Events query result data. + * + */ +export interface EventsResultData { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "eventsResultData"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; +} + +/** + * @interface + * An interface representing EventsResults. + * An events query result. + * + */ +export interface EventsResults { + /** + * @member {string} [odatacontext] OData context metadata endpoint for this + * response + */ + odatacontext?: string; + /** + * @member {ErrorInfo[]} [aimessages] OData messages for this response. + */ + aimessages?: ErrorInfo[]; + /** + * @member {EventsResultDataUnion[]} [value] Contents of the events query + * result. + */ + value?: EventsResultDataUnion[]; +} + +/** + * @interface + * An interface representing EventsResult. + * An event query result. + * + */ +export interface EventsResult { + /** + * @member {ErrorInfo[]} [aimessages] OData messages for this response. + */ + aimessages?: ErrorInfo[]; + /** + * @member {EventsResultDataUnion} [value] + */ + value?: EventsResultDataUnion; +} + +/** + * @interface + * An interface representing EventsTraceInfo. + * The trace information + * + */ +export interface EventsTraceInfo { + /** + * @member {string} [message] The trace message + */ + message?: string; + /** + * @member {number} [severityLevel] The trace severity level + */ + severityLevel?: number; +} + +/** + * @interface + * An interface representing EventsTraceResult. + * A trace result + * + */ +export interface EventsTraceResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "trace"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsTraceInfo} [trace] + */ + trace?: EventsTraceInfo; +} + +/** + * @interface + * An interface representing EventsCustomEventInfo. + * The custom event information + * + */ +export interface EventsCustomEventInfo { + /** + * @member {string} [name] The name of the custom event + */ + name?: string; +} + +/** + * @interface + * An interface representing EventsCustomEventResult. + * A custom event result + * + */ +export interface EventsCustomEventResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "customEvent"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsCustomEventInfo} [customEvent] + */ + customEvent?: EventsCustomEventInfo; +} + +/** + * @interface + * An interface representing EventsPageViewInfo. + * The page view information + * + */ +export interface EventsPageViewInfo { + /** + * @member {string} [name] The name of the page + */ + name?: string; + /** + * @member {string} [url] The URL of the page + */ + url?: string; + /** + * @member {string} [duration] The duration of the page view + */ + duration?: string; + /** + * @member {string} [performanceBucket] The performance bucket of the page + * view + */ + performanceBucket?: string; +} + +/** + * @interface + * An interface representing EventsPageViewResult. + * A page view result + * + */ +export interface EventsPageViewResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "pageView"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsPageViewInfo} [pageView] + */ + pageView?: EventsPageViewInfo; +} + +/** + * @interface + * An interface representing EventsBrowserTimingInfo. + * The browser timing information + * + */ +export interface EventsBrowserTimingInfo { + /** + * @member {string} [urlPath] The path of the URL + */ + urlPath?: string; + /** + * @member {string} [urlHost] The host of the URL + */ + urlHost?: string; + /** + * @member {string} [name] The name of the page + */ + name?: string; + /** + * @member {string} [url] The url of the page + */ + url?: string; + /** + * @member {number} [totalDuration] The total duration of the load + */ + totalDuration?: number; + /** + * @member {string} [performanceBucket] The performance bucket of the load + */ + performanceBucket?: string; + /** + * @member {number} [networkDuration] The network duration of the load + */ + networkDuration?: number; + /** + * @member {number} [sendDuration] The send duration of the load + */ + sendDuration?: number; + /** + * @member {number} [receiveDuration] The receive duration of the load + */ + receiveDuration?: number; + /** + * @member {number} [processingDuration] The processing duration of the load + */ + processingDuration?: number; +} + +/** + * @interface + * An interface representing EventsClientPerformanceInfo. + * Client performance information + * + */ +export interface EventsClientPerformanceInfo { + /** + * @member {string} [name] The name of the client performance + */ + name?: string; +} + +/** + * @interface + * An interface representing EventsBrowserTimingResult. + * A browser timing result + * + */ +export interface EventsBrowserTimingResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "browserTiming"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsBrowserTimingInfo} [browserTiming] + */ + browserTiming?: EventsBrowserTimingInfo; + /** + * @member {EventsClientPerformanceInfo} [clientPerformance] + */ + clientPerformance?: EventsClientPerformanceInfo; +} + +/** + * @interface + * An interface representing EventsRequestInfo. + * The request info + * + */ +export interface EventsRequestInfo { + /** + * @member {string} [name] The name of the request + */ + name?: string; + /** + * @member {string} [url] The URL of the request + */ + url?: string; + /** + * @member {string} [success] Indicates if the request was successful + */ + success?: string; + /** + * @member {number} [duration] The duration of the request + */ + duration?: number; + /** + * @member {string} [performanceBucket] The performance bucket of the request + */ + performanceBucket?: string; + /** + * @member {string} [resultCode] The result code of the request + */ + resultCode?: string; + /** + * @member {string} [source] The source of the request + */ + source?: string; + /** + * @member {string} [id] The ID of the request + */ + id?: string; +} + +/** + * @interface + * An interface representing EventsRequestResult. + * A request result + * + */ +export interface EventsRequestResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "request"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsRequestInfo} [request] + */ + request?: EventsRequestInfo; +} + +/** + * @interface + * An interface representing EventsDependencyInfo. + * The dependency info + * + */ +export interface EventsDependencyInfo { + /** + * @member {string} [target] The target of the dependency + */ + target?: string; + /** + * @member {string} [data] The data of the dependency + */ + data?: string; + /** + * @member {string} [success] Indicates if the dependency was successful + */ + success?: string; + /** + * @member {number} [duration] The duration of the dependency + */ + duration?: number; + /** + * @member {string} [performanceBucket] The performance bucket of the + * dependency + */ + performanceBucket?: string; + /** + * @member {string} [resultCode] The result code of the dependency + */ + resultCode?: string; + /** + * @member {string} [type] The type of the dependency + */ + type?: string; + /** + * @member {string} [name] The name of the dependency + */ + name?: string; + /** + * @member {string} [id] The ID of the dependency + */ + id?: string; +} + +/** + * @interface + * An interface representing EventsDependencyResult. + * A dependency result + * + */ +export interface EventsDependencyResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "dependency"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsDependencyInfo} [dependency] + */ + dependency?: EventsDependencyInfo; +} + +/** + * @interface + * An interface representing EventsExceptionDetailsParsedStack. + * A parsed stack entry + * + */ +export interface EventsExceptionDetailsParsedStack { + /** + * @member {string} [assembly] The assembly of the stack entry + */ + assembly?: string; + /** + * @member {string} [method] The method of the stack entry + */ + method?: string; + /** + * @member {number} [level] The level of the stack entry + */ + level?: number; + /** + * @member {number} [line] The line of the stack entry + */ + line?: number; +} + +/** + * @interface + * An interface representing EventsExceptionDetail. + * Exception details + * + */ +export interface EventsExceptionDetail { + /** + * @member {string} [severityLevel] The severity level of the exception + * detail + */ + severityLevel?: string; + /** + * @member {string} [outerId] The outer ID of the exception detail + */ + outerId?: string; + /** + * @member {string} [message] The message of the exception detail + */ + message?: string; + /** + * @member {string} [type] The type of the exception detail + */ + type?: string; + /** + * @member {string} [id] The ID of the exception detail + */ + id?: string; + /** + * @member {EventsExceptionDetailsParsedStack[]} [parsedStack] The parsed + * stack + */ + parsedStack?: EventsExceptionDetailsParsedStack[]; +} + +/** + * @interface + * An interface representing EventsExceptionInfo. + * The exception info + * + */ +export interface EventsExceptionInfo { + /** + * @member {number} [severityLevel] The severity level of the exception + */ + severityLevel?: number; + /** + * @member {string} [problemId] The problem ID of the exception + */ + problemId?: string; + /** + * @member {string} [handledAt] Indicates where the exception was handled at + */ + handledAt?: string; + /** + * @member {string} [assembly] The assembly which threw the exception + */ + assembly?: string; + /** + * @member {string} [method] The method that threw the exception + */ + method?: string; + /** + * @member {string} [message] The message of the exception + */ + message?: string; + /** + * @member {string} [type] The type of the exception + */ + type?: string; + /** + * @member {string} [outerType] The outer type of the exception + */ + outerType?: string; + /** + * @member {string} [outerMethod] The outer method of the exception + */ + outerMethod?: string; + /** + * @member {string} [outerAssembly] The outer assembly of the exception + */ + outerAssembly?: string; + /** + * @member {string} [outerMessage] The outer message of the exception + */ + outerMessage?: string; + /** + * @member {string} [innermostType] The inner most type of the exception + */ + innermostType?: string; + /** + * @member {string} [innermostMessage] The inner most message of the + * exception + */ + innermostMessage?: string; + /** + * @member {string} [innermostMethod] The inner most method of the exception + */ + innermostMethod?: string; + /** + * @member {string} [innermostAssembly] The inner most assembly of the + * exception + */ + innermostAssembly?: string; + /** + * @member {EventsExceptionDetail[]} [details] The details of the exception + */ + details?: EventsExceptionDetail[]; +} + +/** + * @interface + * An interface representing EventsExceptionResult. + * An exception result + * + */ +export interface EventsExceptionResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "exception"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsExceptionInfo} [exception] + */ + exception?: EventsExceptionInfo; +} + +/** + * @interface + * An interface representing EventsAvailabilityResultInfo. + * The availability result info + * + */ +export interface EventsAvailabilityResultInfo { + /** + * @member {string} [name] The name of the availability result + */ + name?: string; + /** + * @member {string} [success] Indicates if the availability result was + * successful + */ + success?: string; + /** + * @member {number} [duration] The duration of the availability result + */ + duration?: number; + /** + * @member {string} [performanceBucket] The performance bucket of the + * availability result + */ + performanceBucket?: string; + /** + * @member {string} [message] The message of the availability result + */ + message?: string; + /** + * @member {string} [location] The location of the availability result + */ + location?: string; + /** + * @member {string} [id] The ID of the availability result + */ + id?: string; + /** + * @member {string} [size] The size of the availability result + */ + size?: string; +} + +/** + * @interface + * An interface representing EventsAvailabilityResultResult. + * An availability result result + * + */ +export interface EventsAvailabilityResultResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "availabilityResult"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsAvailabilityResultInfo} [availabilityResult] + */ + availabilityResult?: EventsAvailabilityResultInfo; +} + +/** + * @interface + * An interface representing EventsPerformanceCounterInfo. + * The performance counter info + * + */ +export interface EventsPerformanceCounterInfo { + /** + * @member {number} [value] The value of the performance counter + */ + value?: number; + /** + * @member {string} [name] The name of the performance counter + */ + name?: string; + /** + * @member {string} [category] The category of the performance counter + */ + category?: string; + /** + * @member {string} [counter] The counter of the performance counter + */ + counter?: string; + /** + * @member {string} [instanceName] The instance name of the performance + * counter + */ + instanceName?: string; + /** + * @member {string} [instance] The instance of the performance counter + */ + instance?: string; +} + +/** + * @interface + * An interface representing EventsPerformanceCounterResult. + * A performance counter result + * + */ +export interface EventsPerformanceCounterResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "performanceCounter"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsPerformanceCounterInfo} [performanceCounter] + */ + performanceCounter?: EventsPerformanceCounterInfo; +} + +/** + * @interface + * An interface representing EventsCustomMetricInfo. + * The custom metric info + * + */ +export interface EventsCustomMetricInfo { + /** + * @member {string} [name] The name of the custom metric + */ + name?: string; + /** + * @member {number} [value] The value of the custom metric + */ + value?: number; + /** + * @member {number} [valueSum] The sum of the custom metric + */ + valueSum?: number; + /** + * @member {number} [valueCount] The count of the custom metric + */ + valueCount?: number; + /** + * @member {number} [valueMin] The minimum value of the custom metric + */ + valueMin?: number; + /** + * @member {number} [valueMax] The maximum value of the custom metric + */ + valueMax?: number; + /** + * @member {number} [valueStdDev] The standard deviation of the custom metric + */ + valueStdDev?: number; +} + +/** + * @interface + * An interface representing EventsCustomMetricResult. + * A custom metric result + * + */ +export interface EventsCustomMetricResult { + /** + * @member {string} type Polymorphic Discriminator + */ + type: "customMetric"; + /** + * @member {string} [id] The unique ID for this event. + */ + id?: string; + /** + * @member {number} [count] Count of the event + */ + count?: number; + /** + * @member {Date} [timestamp] Timestamp of the event + */ + timestamp?: Date; + /** + * @member {EventsResultDataCustomDimensions} [customDimensions] Custom + * dimensions of the event + */ + customDimensions?: EventsResultDataCustomDimensions; + /** + * @member {EventsResultDataCustomMeasurements} [customMeasurements] Custom + * measurements of the event + */ + customMeasurements?: EventsResultDataCustomMeasurements; + /** + * @member {EventsOperationInfo} [operation] Operation info of the event + */ + operation?: EventsOperationInfo; + /** + * @member {EventsSessionInfo} [session] Session info of the event + */ + session?: EventsSessionInfo; + /** + * @member {EventsUserInfo} [user] User info of the event + */ + user?: EventsUserInfo; + /** + * @member {EventsCloudInfo} [cloud] Cloud info of the event + */ + cloud?: EventsCloudInfo; + /** + * @member {EventsAiInfo} [ai] AI info of the event + */ + ai?: EventsAiInfo; + /** + * @member {EventsApplicationInfo} [application] Application info of the + * event + */ + application?: EventsApplicationInfo; + /** + * @member {EventsClientInfo} [client] Client info of the event + */ + client?: EventsClientInfo; + /** + * @member {EventsCustomMetricInfo} [customMetric] + */ + customMetric?: EventsCustomMetricInfo; +} + +/** + * @interface + * An interface representing QueryBody. + * The Analytics query. Learn more about the [Analytics query + * syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * + */ +export interface QueryBody { + /** + * @member {string} query The query to execute. + */ + query: string; + /** + * @member {string} [timespan] Optional. The timespan over which to query + * data. This is an ISO8601 time period value. This timespan is applied in + * addition to any that are specified in the query expression. + */ + timespan?: string; + /** + * @member {string[]} [applications] A list of Application IDs for + * cross-application queries. + */ + applications?: string[]; +} + +/** + * @interface + * An interface representing Column. + * @summary A table column. + * + * A column in a table. + * + */ +export interface Column { + /** + * @member {string} [name] The name of this column. + */ + name?: string; + /** + * @member {string} [type] The data type of this column. + */ + type?: string; +} + +/** + * @interface + * An interface representing Table. + * @summary A query response table. + * + * Contains the columns and rows for one table in a query response. + * + */ +export interface Table { + /** + * @member {string} name The name of the table. + */ + name: string; + /** + * @member {Column[]} columns The list of columns in this table. + */ + columns: Column[]; + /** + * @member {any[][]} rows The resulting rows from this query. + */ + rows: any[][]; +} + +/** + * @interface + * An interface representing QueryResults. + * @summary A query response. + * + * Contains the tables, columns & rows resulting from a query. + * + */ +export interface QueryResults { + /** + * @member {Table[]} tables The list of tables, columns and rows. + */ + tables: Table[]; +} + +/** + * @interface + * An interface representing ErrorResponse. + * @summary Error details. + * + * Contains details when the response code indicates an error. + * + */ +export interface ErrorResponse { + /** + * @member {ErrorInfo} error The error details. + */ + error: ErrorInfo; +} + +/** + * @interface + * An interface representing ApplicationInsightsDataClientOptions. + * @extends ServiceClientOptions + */ +export interface ApplicationInsightsDataClientOptions extends ServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + +/** + * @interface + * An interface representing MetricsGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface MetricsGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [timespan] The timespan over which to retrieve metric + * values. This is an ISO8601 time period value. If timespan is omitted, a + * default time range of `PT12H` ("last 12 hours") is used. The actual + * timespan that is queried may be adjusted by the server based. In all + * cases, the actual time span used for the query is included in the + * response. + */ + timespan?: string; + /** + * @member {string} [interval] The time interval to use when retrieving + * metric values. This is an ISO8601 duration. If interval is omitted, the + * metric value is aggregated across the entire timespan. If interval is + * supplied, the server may adjust the interval to a more appropriate size + * based on the timespan used for the query. In all cases, the actual + * interval used for the query is included in the response. + */ + interval?: string; + /** + * @member {MetricsAggregation[]} [aggregation] The aggregation to use when + * computing the metric values. To retrieve more than one aggregation at a + * time, separate them with a comma. If no aggregation is specified, then the + * default aggregation for the metric is used. + */ + aggregation?: MetricsAggregation[]; + /** + * @member {MetricsSegment[]} [segment] The name of the dimension to segment + * the metric values by. This dimension must be applicable to the metric you + * are retrieving. To segment by more than one dimension at a time, separate + * them with a comma (,). In this case, the metric data will be segmented in + * the order the dimensions are listed in the parameter. + */ + segment?: MetricsSegment[]; + /** + * @member {number} [top] The number of segments to return. This value is + * only valid when segment is specified. + */ + top?: number; + /** + * @member {string} [orderby] The aggregation function and direction to sort + * the segments by. This value is only valid when segment is specified. + */ + orderby?: string; + /** + * @member {string} [filter] An expression used to filter the results. This + * value should be a valid OData filter expression where the keys of each + * clause should be applicable dimensions for the metric you are retrieving. + */ + filter?: string; +} + +/** + * @interface + * An interface representing EventsGetByTypeOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface EventsGetByTypeOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [timespan] Optional. The timespan over which to retrieve + * events. This is an ISO8601 time period value. This timespan is applied in + * addition to any that are specified in the Odata expression. + */ + timespan?: string; + /** + * @member {string} [filter] An expression used to filter the returned events + */ + filter?: string; + /** + * @member {string} [search] A free-text search expression to match for + * whether a particular event should be returned + */ + search?: string; + /** + * @member {string} [orderby] A comma-separated list of properties with + * \"asc\" (the default) or \"desc\" to control the order of returned events + */ + orderby?: string; + /** + * @member {string} [select] Limits the properties to just those requested on + * each returned event + */ + select?: string; + /** + * @member {number} [skip] The number of items to skip over before returning + * events + */ + skip?: number; + /** + * @member {number} [top] The number of events to return + */ + top?: number; + /** + * @member {string} [format] Format for the returned events + */ + format?: string; + /** + * @member {boolean} [count] Request a count of matching items included with + * the returned events + */ + count?: boolean; + /** + * @member {string} [apply] An expression used for aggregation over returned + * events + */ + apply?: string; +} + +/** + * @interface + * An interface representing EventsGetOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface EventsGetOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [timespan] Optional. The timespan over which to retrieve + * events. This is an ISO8601 time period value. This timespan is applied in + * addition to any that are specified in the Odata expression. + */ + timespan?: string; +} + +/** + * Defines values for MetricId. + * Possible values include: 'requests/count', 'requests/duration', 'requests/failed', + * 'users/count', 'users/authenticated', 'pageViews/count', 'pageViews/duration', + * 'client/processingDuration', 'client/receiveDuration', 'client/networkDuration', + * 'client/sendDuration', 'client/totalDuration', 'dependencies/count', 'dependencies/failed', + * 'dependencies/duration', 'exceptions/count', 'exceptions/browser', 'exceptions/server', + * 'sessions/count', 'performanceCounters/requestExecutionTime', + * 'performanceCounters/requestsPerSecond', 'performanceCounters/requestsInQueue', + * 'performanceCounters/memoryAvailableBytes', 'performanceCounters/exceptionsPerSecond', + * 'performanceCounters/processCpuPercentage', 'performanceCounters/processIOBytesPerSecond', + * 'performanceCounters/processPrivateBytes', 'performanceCounters/processorCpuPercentage', + * 'availabilityResults/availabilityPercentage', 'availabilityResults/duration', + * 'billing/telemetryCount', 'customEvents/count' + * @readonly + * @enum {string} + */ +export type MetricId = 'requests/count' | 'requests/duration' | 'requests/failed' | 'users/count' | 'users/authenticated' | 'pageViews/count' | 'pageViews/duration' | 'client/processingDuration' | 'client/receiveDuration' | 'client/networkDuration' | 'client/sendDuration' | 'client/totalDuration' | 'dependencies/count' | 'dependencies/failed' | 'dependencies/duration' | 'exceptions/count' | 'exceptions/browser' | 'exceptions/server' | 'sessions/count' | 'performanceCounters/requestExecutionTime' | 'performanceCounters/requestsPerSecond' | 'performanceCounters/requestsInQueue' | 'performanceCounters/memoryAvailableBytes' | 'performanceCounters/exceptionsPerSecond' | 'performanceCounters/processCpuPercentage' | 'performanceCounters/processIOBytesPerSecond' | 'performanceCounters/processPrivateBytes' | 'performanceCounters/processorCpuPercentage' | 'availabilityResults/availabilityPercentage' | 'availabilityResults/duration' | 'billing/telemetryCount' | 'customEvents/count'; + +/** + * Defines values for MetricsAggregation. + * Possible values include: 'min', 'max', 'avg', 'sum', 'count', 'unique' + * @readonly + * @enum {string} + */ +export type MetricsAggregation = 'min' | 'max' | 'avg' | 'sum' | 'count' | 'unique'; + +/** + * Defines values for MetricsSegment. + * Possible values include: 'applicationBuild', 'applicationVersion', + * 'authenticatedOrAnonymousTraffic', 'browser', 'browserVersion', 'city', 'cloudRoleName', + * 'cloudServiceName', 'continent', 'countryOrRegion', 'deploymentId', 'deploymentUnit', + * 'deviceType', 'environment', 'hostingLocation', 'instanceName' + * @readonly + * @enum {string} + */ +export type MetricsSegment = 'applicationBuild' | 'applicationVersion' | 'authenticatedOrAnonymousTraffic' | 'browser' | 'browserVersion' | 'city' | 'cloudRoleName' | 'cloudServiceName' | 'continent' | 'countryOrRegion' | 'deploymentId' | 'deploymentUnit' | 'deviceType' | 'environment' | 'hostingLocation' | 'instanceName'; + +/** + * Defines values for EventType. + * Possible values include: '$all', 'traces', 'customEvents', 'pageViews', 'browserTimings', + * 'requests', 'dependencies', 'exceptions', 'availabilityResults', 'performanceCounters', + * 'customMetrics' + * @readonly + * @enum {string} + */ +export type EventType = '$all' | 'traces' | 'customEvents' | 'pageViews' | 'browserTimings' | 'requests' | 'dependencies' | 'exceptions' | 'availabilityResults' | 'performanceCounters' | 'customMetrics'; + +/** + * Contains response data for the get operation. + */ +export type MetricsGetResponse = MetricsResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricsResult; + }; +}; + +/** + * Contains response data for the getMultiple operation. + */ +export type MetricsGetMultipleResponse = Array & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: MetricsResultsItem[]; + }; +}; + +/** + * Contains response data for the getMetadata operation. + */ +export type MetricsGetMetadataResponse = { + /** + * The parsed response body. + */ + body: any; + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: any; + }; +}; + +/** + * Contains response data for the getByType operation. + */ +export type EventsGetByTypeResponse = EventsResults & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: EventsResults; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type EventsGetResponse = EventsResults & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: EventsResults; + }; +}; + +/** + * Contains response data for the execute operation. + */ +export type QueryExecuteResponse = QueryResults & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: QueryResults; + }; +}; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/models/mappers.ts b/sdk/applicationinsights/applicationinsights-query/lib/models/mappers.ts new file mode 100644 index 000000000000..41143e2b862a --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/models/mappers.ts @@ -0,0 +1,1767 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 * as msRest from "@azure/ms-rest-js"; + + +export const MetricsPostBodySchemaParameters: msRest.CompositeMapper = { + serializedName: "metricsPostBodySchema_parameters", + type: { + name: "Composite", + className: "MetricsPostBodySchemaParameters", + modelProperties: { + metricId: { + required: true, + serializedName: "metricId", + type: { + name: "String" + } + }, + timespan: { + serializedName: "timespan", + type: { + name: "String" + } + }, + aggregation: { + serializedName: "aggregation", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + interval: { + serializedName: "interval", + type: { + name: "TimeSpan" + } + }, + segment: { + serializedName: "segment", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + top: { + serializedName: "top", + type: { + name: "Number" + } + }, + orderby: { + serializedName: "orderby", + type: { + name: "String" + } + }, + filter: { + serializedName: "filter", + type: { + name: "String" + } + } + } + } +}; + +export const MetricsPostBodySchema: msRest.CompositeMapper = { + serializedName: "metricsPostBodySchema", + type: { + name: "Composite", + className: "MetricsPostBodySchema", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + parameters: { + required: true, + serializedName: "parameters", + type: { + name: "Composite", + className: "MetricsPostBodySchemaParameters" + } + } + } + } +}; + +export const MetricsSegmentInfo: msRest.CompositeMapper = { + serializedName: "metricsSegmentInfo", + type: { + name: "Composite", + className: "MetricsSegmentInfo", + modelProperties: { + start: { + serializedName: "start", + type: { + name: "DateTime" + } + }, + end: { + serializedName: "end", + type: { + name: "DateTime" + } + }, + segments: { + serializedName: "segments", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricsSegmentInfo", + additionalProperties: { + type: { + name: "Object" + } + } + } + } + } + } + }, + additionalProperties: { + type: { + name: "Object" + } + } + } +}; + +export const MetricsResultInfo: msRest.CompositeMapper = { + serializedName: "metricsResultInfo", + type: { + name: "Composite", + className: "MetricsResultInfo", + modelProperties: { + start: { + serializedName: "start", + type: { + name: "DateTime" + } + }, + end: { + serializedName: "end", + type: { + name: "DateTime" + } + }, + interval: { + serializedName: "interval", + type: { + name: "TimeSpan" + } + }, + segments: { + serializedName: "segments", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricsSegmentInfo", + additionalProperties: { + type: { + name: "Object" + } + } + } + } + } + } + }, + additionalProperties: { + type: { + name: "Object" + } + } + } +}; + +export const MetricsResult: msRest.CompositeMapper = { + serializedName: "metricsResult", + type: { + name: "Composite", + className: "MetricsResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Composite", + className: "MetricsResultInfo", + additionalProperties: { + type: { + name: "Object" + } + } + } + } + } + } +}; + +export const MetricsResultsItem: msRest.CompositeMapper = { + serializedName: "metricsResultsItem", + type: { + name: "Composite", + className: "MetricsResultsItem", + modelProperties: { + id: { + required: true, + serializedName: "id", + type: { + name: "String" + } + }, + status: { + required: true, + serializedName: "status", + type: { + name: "Number" + } + }, + body: { + required: true, + serializedName: "body", + type: { + name: "Composite", + className: "MetricsResult" + } + } + } + } +}; + +export const ErrorDetail: msRest.CompositeMapper = { + 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: { + serializedName: "target", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "Object" + } + } + } + } +}; + +export const ErrorInfo: msRest.CompositeMapper = { + serializedName: "errorInfo", + type: { + name: "Composite", + className: "ErrorInfo", + modelProperties: { + code: { + required: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + required: true, + serializedName: "message", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + innererror: { + serializedName: "innererror", + type: { + name: "Composite", + className: "ErrorInfo" + } + }, + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "Object" + } + } + } + } +}; + +export const EventsResultDataCustomDimensions: msRest.CompositeMapper = { + serializedName: "eventsResultData_customDimensions", + type: { + name: "Composite", + className: "EventsResultDataCustomDimensions", + modelProperties: { + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "Object" + } + } + } + } +}; + +export const EventsResultDataCustomMeasurements: msRest.CompositeMapper = { + serializedName: "eventsResultData_customMeasurements", + type: { + name: "Composite", + className: "EventsResultDataCustomMeasurements", + modelProperties: { + additionalProperties: { + serializedName: "additionalProperties", + type: { + name: "Object" + } + } + } + } +}; + +export const EventsOperationInfo: msRest.CompositeMapper = { + serializedName: "eventsOperationInfo", + type: { + name: "Composite", + className: "EventsOperationInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + parentId: { + serializedName: "parentId", + type: { + name: "String" + } + }, + syntheticSource: { + serializedName: "syntheticSource", + type: { + name: "String" + } + } + } + } +}; + +export const EventsSessionInfo: msRest.CompositeMapper = { + serializedName: "eventsSessionInfo", + type: { + name: "Composite", + className: "EventsSessionInfo", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const EventsUserInfo: msRest.CompositeMapper = { + serializedName: "eventsUserInfo", + type: { + name: "Composite", + className: "EventsUserInfo", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + accountId: { + serializedName: "accountId", + type: { + name: "String" + } + }, + authenticatedId: { + serializedName: "authenticatedId", + type: { + name: "String" + } + } + } + } +}; + +export const EventsCloudInfo: msRest.CompositeMapper = { + serializedName: "eventsCloudInfo", + type: { + name: "Composite", + className: "EventsCloudInfo", + modelProperties: { + roleName: { + serializedName: "roleName", + type: { + name: "String" + } + }, + roleInstance: { + serializedName: "roleInstance", + type: { + name: "String" + } + } + } + } +}; + +export const EventsAiInfo: msRest.CompositeMapper = { + serializedName: "eventsAiInfo", + type: { + name: "Composite", + className: "EventsAiInfo", + modelProperties: { + iKey: { + serializedName: "iKey", + type: { + name: "String" + } + }, + appName: { + serializedName: "appName", + type: { + name: "String" + } + }, + appId: { + serializedName: "appId", + type: { + name: "String" + } + }, + sdkVersion: { + serializedName: "sdkVersion", + type: { + name: "String" + } + } + } + } +}; + +export const EventsApplicationInfo: msRest.CompositeMapper = { + serializedName: "eventsApplicationInfo", + type: { + name: "Composite", + className: "EventsApplicationInfo", + modelProperties: { + version: { + serializedName: "version", + type: { + name: "String" + } + } + } + } +}; + +export const EventsClientInfo: msRest.CompositeMapper = { + serializedName: "eventsClientInfo", + type: { + name: "Composite", + className: "EventsClientInfo", + modelProperties: { + model: { + serializedName: "model", + type: { + name: "String" + } + }, + os: { + serializedName: "os", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + browser: { + serializedName: "browser", + type: { + name: "String" + } + }, + ip: { + serializedName: "ip", + type: { + name: "String" + } + }, + city: { + serializedName: "city", + type: { + name: "String" + } + }, + stateOrProvince: { + serializedName: "stateOrProvince", + type: { + name: "String" + } + }, + countryOrRegion: { + serializedName: "countryOrRegion", + type: { + name: "String" + } + } + } + } +}; + +export const EventsResultData: msRest.CompositeMapper = { + serializedName: "eventsResultData", + type: { + name: "Composite", + polymorphicDiscriminator: { + serializedName: "type", + clientName: "type" + }, + uberParent: "EventsResultData", + className: "EventsResultData", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + count: { + serializedName: "count", + type: { + name: "Number" + } + }, + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + customDimensions: { + serializedName: "customDimensions", + type: { + name: "Composite", + className: "EventsResultDataCustomDimensions" + } + }, + customMeasurements: { + serializedName: "customMeasurements", + type: { + name: "Composite", + className: "EventsResultDataCustomMeasurements" + } + }, + operation: { + serializedName: "operation", + type: { + name: "Composite", + className: "EventsOperationInfo" + } + }, + session: { + serializedName: "session", + type: { + name: "Composite", + className: "EventsSessionInfo" + } + }, + user: { + serializedName: "user", + type: { + name: "Composite", + className: "EventsUserInfo" + } + }, + cloud: { + serializedName: "cloud", + type: { + name: "Composite", + className: "EventsCloudInfo" + } + }, + ai: { + serializedName: "ai", + type: { + name: "Composite", + className: "EventsAiInfo" + } + }, + application: { + serializedName: "application", + type: { + name: "Composite", + className: "EventsApplicationInfo" + } + }, + client: { + serializedName: "client", + type: { + name: "Composite", + className: "EventsClientInfo" + } + }, + type: { + required: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const EventsResults: msRest.CompositeMapper = { + serializedName: "eventsResults", + type: { + name: "Composite", + className: "EventsResults", + modelProperties: { + odatacontext: { + serializedName: "@odata\\.context", + type: { + name: "String" + } + }, + aimessages: { + serializedName: "@ai\\.messages", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorInfo" + } + } + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EventsResultData" + } + } + } + } + } + } +}; + +export const EventsResult: msRest.CompositeMapper = { + serializedName: "eventsResult", + type: { + name: "Composite", + className: "EventsResult", + modelProperties: { + aimessages: { + serializedName: "@ai\\.messages", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorInfo" + } + } + } + }, + value: { + serializedName: "value", + type: { + name: "Composite", + className: "EventsResultData" + } + } + } + } +}; + +export const EventsTraceInfo: msRest.CompositeMapper = { + serializedName: "eventsTraceInfo", + type: { + name: "Composite", + className: "EventsTraceInfo", + modelProperties: { + message: { + serializedName: "message", + type: { + name: "String" + } + }, + severityLevel: { + serializedName: "severityLevel", + type: { + name: "Number" + } + } + } + } +}; + +export const EventsTraceResult: msRest.CompositeMapper = { + serializedName: "trace", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsTraceResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + trace: { + serializedName: "trace", + type: { + name: "Composite", + className: "EventsTraceInfo" + } + } + } + } +}; + +export const EventsCustomEventInfo: msRest.CompositeMapper = { + serializedName: "eventsCustomEventInfo", + type: { + name: "Composite", + className: "EventsCustomEventInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const EventsCustomEventResult: msRest.CompositeMapper = { + serializedName: "customEvent", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsCustomEventResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + customEvent: { + serializedName: "customEvent", + type: { + name: "Composite", + className: "EventsCustomEventInfo" + } + } + } + } +}; + +export const EventsPageViewInfo: msRest.CompositeMapper = { + serializedName: "eventsPageViewInfo", + type: { + name: "Composite", + className: "EventsPageViewInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + url: { + serializedName: "url", + type: { + name: "String" + } + }, + duration: { + serializedName: "duration", + type: { + name: "String" + } + }, + performanceBucket: { + serializedName: "performanceBucket", + type: { + name: "String" + } + } + } + } +}; + +export const EventsPageViewResult: msRest.CompositeMapper = { + serializedName: "pageView", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsPageViewResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + pageView: { + serializedName: "pageView", + type: { + name: "Composite", + className: "EventsPageViewInfo" + } + } + } + } +}; + +export const EventsBrowserTimingInfo: msRest.CompositeMapper = { + serializedName: "eventsBrowserTimingInfo", + type: { + name: "Composite", + className: "EventsBrowserTimingInfo", + modelProperties: { + urlPath: { + serializedName: "urlPath", + type: { + name: "String" + } + }, + urlHost: { + serializedName: "urlHost", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + url: { + serializedName: "url", + type: { + name: "String" + } + }, + totalDuration: { + serializedName: "totalDuration", + type: { + name: "Number" + } + }, + performanceBucket: { + serializedName: "performanceBucket", + type: { + name: "String" + } + }, + networkDuration: { + serializedName: "networkDuration", + type: { + name: "Number" + } + }, + sendDuration: { + serializedName: "sendDuration", + type: { + name: "Number" + } + }, + receiveDuration: { + serializedName: "receiveDuration", + type: { + name: "Number" + } + }, + processingDuration: { + serializedName: "processingDuration", + type: { + name: "Number" + } + } + } + } +}; + +export const EventsClientPerformanceInfo: msRest.CompositeMapper = { + serializedName: "eventsClientPerformanceInfo", + type: { + name: "Composite", + className: "EventsClientPerformanceInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const EventsBrowserTimingResult: msRest.CompositeMapper = { + serializedName: "browserTiming", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsBrowserTimingResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + browserTiming: { + serializedName: "browserTiming", + type: { + name: "Composite", + className: "EventsBrowserTimingInfo" + } + }, + clientPerformance: { + serializedName: "clientPerformance", + type: { + name: "Composite", + className: "EventsClientPerformanceInfo" + } + } + } + } +}; + +export const EventsRequestInfo: msRest.CompositeMapper = { + serializedName: "eventsRequestInfo", + type: { + name: "Composite", + className: "EventsRequestInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + url: { + serializedName: "url", + type: { + name: "String" + } + }, + success: { + serializedName: "success", + type: { + name: "String" + } + }, + duration: { + serializedName: "duration", + type: { + name: "Number" + } + }, + performanceBucket: { + serializedName: "performanceBucket", + type: { + name: "String" + } + }, + resultCode: { + serializedName: "resultCode", + type: { + name: "String" + } + }, + source: { + serializedName: "source", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const EventsRequestResult: msRest.CompositeMapper = { + serializedName: "request", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsRequestResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + request: { + serializedName: "request", + type: { + name: "Composite", + className: "EventsRequestInfo" + } + } + } + } +}; + +export const EventsDependencyInfo: msRest.CompositeMapper = { + serializedName: "eventsDependencyInfo", + type: { + name: "Composite", + className: "EventsDependencyInfo", + modelProperties: { + target: { + serializedName: "target", + type: { + name: "String" + } + }, + data: { + serializedName: "data", + type: { + name: "String" + } + }, + success: { + serializedName: "success", + type: { + name: "String" + } + }, + duration: { + serializedName: "duration", + type: { + name: "Number" + } + }, + performanceBucket: { + serializedName: "performanceBucket", + type: { + name: "String" + } + }, + resultCode: { + serializedName: "resultCode", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const EventsDependencyResult: msRest.CompositeMapper = { + serializedName: "dependency", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsDependencyResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + dependency: { + serializedName: "dependency", + type: { + name: "Composite", + className: "EventsDependencyInfo" + } + } + } + } +}; + +export const EventsExceptionDetailsParsedStack: msRest.CompositeMapper = { + serializedName: "eventsExceptionDetailsParsedStack", + type: { + name: "Composite", + className: "EventsExceptionDetailsParsedStack", + modelProperties: { + assembly: { + serializedName: "assembly", + type: { + name: "String" + } + }, + method: { + serializedName: "method", + type: { + name: "String" + } + }, + level: { + serializedName: "level", + type: { + name: "Number" + } + }, + line: { + serializedName: "line", + type: { + name: "Number" + } + } + } + } +}; + +export const EventsExceptionDetail: msRest.CompositeMapper = { + serializedName: "eventsExceptionDetail", + type: { + name: "Composite", + className: "EventsExceptionDetail", + modelProperties: { + severityLevel: { + serializedName: "severityLevel", + type: { + name: "String" + } + }, + outerId: { + serializedName: "outerId", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + parsedStack: { + serializedName: "parsedStack", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EventsExceptionDetailsParsedStack" + } + } + } + } + } + } +}; + +export const EventsExceptionInfo: msRest.CompositeMapper = { + serializedName: "eventsExceptionInfo", + type: { + name: "Composite", + className: "EventsExceptionInfo", + modelProperties: { + severityLevel: { + serializedName: "severityLevel", + type: { + name: "Number" + } + }, + problemId: { + serializedName: "problemId", + type: { + name: "String" + } + }, + handledAt: { + serializedName: "handledAt", + type: { + name: "String" + } + }, + assembly: { + serializedName: "assembly", + type: { + name: "String" + } + }, + method: { + serializedName: "method", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + outerType: { + serializedName: "outerType", + type: { + name: "String" + } + }, + outerMethod: { + serializedName: "outerMethod", + type: { + name: "String" + } + }, + outerAssembly: { + serializedName: "outerAssembly", + type: { + name: "String" + } + }, + outerMessage: { + serializedName: "outerMessage", + type: { + name: "String" + } + }, + innermostType: { + serializedName: "innermostType", + type: { + name: "String" + } + }, + innermostMessage: { + serializedName: "innermostMessage", + type: { + name: "String" + } + }, + innermostMethod: { + serializedName: "innermostMethod", + type: { + name: "String" + } + }, + innermostAssembly: { + serializedName: "innermostAssembly", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EventsExceptionDetail" + } + } + } + } + } + } +}; + +export const EventsExceptionResult: msRest.CompositeMapper = { + serializedName: "exception", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsExceptionResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + exception: { + serializedName: "exception", + type: { + name: "Composite", + className: "EventsExceptionInfo" + } + } + } + } +}; + +export const EventsAvailabilityResultInfo: msRest.CompositeMapper = { + serializedName: "eventsAvailabilityResultInfo", + type: { + name: "Composite", + className: "EventsAvailabilityResultInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + success: { + serializedName: "success", + type: { + name: "String" + } + }, + duration: { + serializedName: "duration", + type: { + name: "Number" + } + }, + performanceBucket: { + serializedName: "performanceBucket", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + size: { + serializedName: "size", + type: { + name: "String" + } + } + } + } +}; + +export const EventsAvailabilityResultResult: msRest.CompositeMapper = { + serializedName: "availabilityResult", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsAvailabilityResultResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + availabilityResult: { + serializedName: "availabilityResult", + type: { + name: "Composite", + className: "EventsAvailabilityResultInfo" + } + } + } + } +}; + +export const EventsPerformanceCounterInfo: msRest.CompositeMapper = { + serializedName: "eventsPerformanceCounterInfo", + type: { + name: "Composite", + className: "EventsPerformanceCounterInfo", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Number" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + category: { + serializedName: "category", + type: { + name: "String" + } + }, + counter: { + serializedName: "counter", + type: { + name: "String" + } + }, + instanceName: { + serializedName: "instanceName", + type: { + name: "String" + } + }, + instance: { + serializedName: "instance", + type: { + name: "String" + } + } + } + } +}; + +export const EventsPerformanceCounterResult: msRest.CompositeMapper = { + serializedName: "performanceCounter", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsPerformanceCounterResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + performanceCounter: { + serializedName: "performanceCounter", + type: { + name: "Composite", + className: "EventsPerformanceCounterInfo" + } + } + } + } +}; + +export const EventsCustomMetricInfo: msRest.CompositeMapper = { + serializedName: "eventsCustomMetricInfo", + type: { + name: "Composite", + className: "EventsCustomMetricInfo", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Number" + } + }, + valueSum: { + serializedName: "valueSum", + type: { + name: "Number" + } + }, + valueCount: { + serializedName: "valueCount", + type: { + name: "Number" + } + }, + valueMin: { + serializedName: "valueMin", + type: { + name: "Number" + } + }, + valueMax: { + serializedName: "valueMax", + type: { + name: "Number" + } + }, + valueStdDev: { + serializedName: "valueStdDev", + type: { + name: "Number" + } + } + } + } +}; + +export const EventsCustomMetricResult: msRest.CompositeMapper = { + serializedName: "customMetric", + type: { + name: "Composite", + polymorphicDiscriminator: EventsResultData.type.polymorphicDiscriminator, + uberParent: "EventsResultData", + className: "EventsCustomMetricResult", + modelProperties: { + ...EventsResultData.type.modelProperties, + customMetric: { + serializedName: "customMetric", + type: { + name: "Composite", + className: "EventsCustomMetricInfo" + } + } + } + } +}; + +export const QueryBody: msRest.CompositeMapper = { + serializedName: "queryBody", + type: { + name: "Composite", + className: "QueryBody", + modelProperties: { + query: { + required: true, + serializedName: "query", + type: { + name: "String" + } + }, + timespan: { + serializedName: "timespan", + type: { + name: "String" + } + }, + applications: { + serializedName: "applications", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const Column: msRest.CompositeMapper = { + serializedName: "column", + type: { + name: "Composite", + className: "Column", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const Table: msRest.CompositeMapper = { + serializedName: "table", + type: { + name: "Composite", + className: "Table", + modelProperties: { + name: { + required: true, + serializedName: "name", + type: { + name: "String" + } + }, + columns: { + required: true, + serializedName: "columns", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Column" + } + } + } + }, + rows: { + required: true, + serializedName: "rows", + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Object" + } + } + } + } + } + } + } + } +}; + +export const QueryResults: msRest.CompositeMapper = { + serializedName: "queryResults", + type: { + name: "Composite", + className: "QueryResults", + modelProperties: { + tables: { + required: true, + serializedName: "tables", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Table" + } + } + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "errorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + required: true, + serializedName: "error", + type: { + name: "Composite", + className: "ErrorInfo" + } + } + } + } +}; + +export const discriminators = { + 'eventsResultData' : EventsResultData, + 'EventsResultData.trace' : EventsTraceResult, + 'EventsResultData.customEvent' : EventsCustomEventResult, + 'EventsResultData.pageView' : EventsPageViewResult, + 'EventsResultData.browserTiming' : EventsBrowserTimingResult, + 'EventsResultData.request' : EventsRequestResult, + 'EventsResultData.dependency' : EventsDependencyResult, + 'EventsResultData.exception' : EventsExceptionResult, + 'EventsResultData.availabilityResult' : EventsAvailabilityResultResult, + 'EventsResultData.performanceCounter' : EventsPerformanceCounterResult, + 'EventsResultData.customMetric' : EventsCustomMetricResult +}; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/models/metricsMappers.ts b/sdk/applicationinsights/applicationinsights-query/lib/models/metricsMappers.ts new file mode 100644 index 000000000000..63828bb2eb67 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/models/metricsMappers.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + MetricsResult, + MetricsResultInfo, + MetricsSegmentInfo, + ErrorResponse, + ErrorInfo, + ErrorDetail, + MetricsPostBodySchema, + MetricsPostBodySchemaParameters, + MetricsResultsItem +} from "../models/mappers"; + diff --git a/sdk/applicationinsights/applicationinsights-query/lib/models/parameters.ts b/sdk/applicationinsights/applicationinsights-query/lib/models/parameters.ts new file mode 100644 index 000000000000..34c02d6dcd4a --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/models/parameters.ts @@ -0,0 +1,262 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 * as msRest from "@azure/ms-rest-js"; + +export const aggregation: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "aggregation" + ], + mapper: { + serializedName: "aggregation", + constraints: { + MinItems: 1 + }, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + collectionFormat: msRest.QueryCollectionFormat.Csv +}; +export const appId: msRest.OperationURLParameter = { + parameterPath: "appId", + mapper: { + required: true, + serializedName: "appId", + type: { + name: "String" + } + } +}; +export const apply: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "apply" + ], + mapper: { + serializedName: "$apply", + type: { + name: "String" + } + } +}; +export const count: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "count" + ], + mapper: { + serializedName: "$count", + type: { + name: "Boolean" + } + } +}; +export const eventId: msRest.OperationURLParameter = { + parameterPath: "eventId", + mapper: { + required: true, + serializedName: "eventId", + type: { + name: "String" + } + } +}; +export const eventType: msRest.OperationURLParameter = { + parameterPath: "eventType", + mapper: { + required: true, + serializedName: "eventType", + type: { + name: "String" + } + } +}; +export const filter0: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "filter" + ], + mapper: { + serializedName: "filter", + type: { + name: "String" + } + } +}; +export const filter1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "filter" + ], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; +export const format: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "format" + ], + mapper: { + serializedName: "$format", + type: { + name: "String" + } + } +}; +export const interval: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "interval" + ], + mapper: { + serializedName: "interval", + type: { + name: "TimeSpan" + } + } +}; +export const metricId: msRest.OperationURLParameter = { + parameterPath: "metricId", + mapper: { + required: true, + serializedName: "metricId", + type: { + name: "String" + } + } +}; +export const orderby0: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "orderby" + ], + mapper: { + serializedName: "orderby", + type: { + name: "String" + } + } +}; +export const orderby1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "orderby" + ], + mapper: { + serializedName: "$orderby", + type: { + name: "String" + } + } +}; +export const search: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "search" + ], + mapper: { + serializedName: "$search", + type: { + name: "String" + } + } +}; +export const segment: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "segment" + ], + mapper: { + serializedName: "segment", + constraints: { + MinItems: 1 + }, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + collectionFormat: msRest.QueryCollectionFormat.Csv +}; +export const select: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "select" + ], + mapper: { + serializedName: "$select", + type: { + name: "String" + } + } +}; +export const skip: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "skip" + ], + mapper: { + serializedName: "$skip", + type: { + name: "Number" + } + } +}; +export const timespan: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "timespan" + ], + mapper: { + serializedName: "timespan", + type: { + name: "String" + } + } +}; +export const top0: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "top" + ], + mapper: { + serializedName: "top", + type: { + name: "Number" + } + } +}; +export const top1: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "top" + ], + mapper: { + serializedName: "$top", + type: { + name: "Number" + } + } +}; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/models/queryMappers.ts b/sdk/applicationinsights/applicationinsights-query/lib/models/queryMappers.ts new file mode 100644 index 000000000000..a2bf85da4560 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/models/queryMappers.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + QueryBody, + QueryResults, + Table, + Column, + ErrorResponse, + ErrorInfo, + ErrorDetail +} from "../models/mappers"; + diff --git a/sdk/applicationinsights/applicationinsights-query/lib/operations/events.ts b/sdk/applicationinsights/applicationinsights-query/lib/operations/events.ts new file mode 100644 index 000000000000..d6c8cfc3e584 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/operations/events.ts @@ -0,0 +1,182 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/eventsMappers"; +import * as Parameters from "../models/parameters"; +import { ApplicationInsightsDataClientContext } from "../applicationInsightsDataClientContext"; + +/** Class representing a Events. */ +export class Events { + private readonly client: ApplicationInsightsDataClientContext; + + /** + * Create a Events. + * @param {ApplicationInsightsDataClientContext} client Reference to the service client. + */ + constructor(client: ApplicationInsightsDataClientContext) { + this.client = client; + } + + /** + * Executes an OData query for events + * @summary Execute OData query + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param eventType The type of events to query; either a standard event type (`traces`, + * `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or + * `$all` to query across all event types. Possible values include: '$all', 'traces', + * 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', + * 'availabilityResults', 'performanceCounters', 'customMetrics' + * @param [options] The optional parameters + * @returns Promise + */ + getByType(appId: string, eventType: Models.EventType, options?: Models.EventsGetByTypeOptionalParams): Promise; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param eventType The type of events to query; either a standard event type (`traces`, + * `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or + * `$all` to query across all event types. Possible values include: '$all', 'traces', + * 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', + * 'availabilityResults', 'performanceCounters', 'customMetrics' + * @param callback The callback + */ + getByType(appId: string, eventType: Models.EventType, callback: msRest.ServiceCallback): void; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param eventType The type of events to query; either a standard event type (`traces`, + * `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or + * `$all` to query across all event types. Possible values include: '$all', 'traces', + * 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', + * 'availabilityResults', 'performanceCounters', 'customMetrics' + * @param options The optional parameters + * @param callback The callback + */ + getByType(appId: string, eventType: Models.EventType, options: Models.EventsGetByTypeOptionalParams, callback: msRest.ServiceCallback): void; + getByType(appId: string, eventType: Models.EventType, options?: Models.EventsGetByTypeOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + appId, + eventType, + options + }, + getByTypeOperationSpec, + callback) as Promise; + } + + /** + * Gets the data for a single event + * @summary Get an event + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param eventType The type of events to query; either a standard event type (`traces`, + * `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or + * `$all` to query across all event types. Possible values include: '$all', 'traces', + * 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', + * 'availabilityResults', 'performanceCounters', 'customMetrics' + * @param eventId ID of event. + * @param [options] The optional parameters + * @returns Promise + */ + get(appId: string, eventType: Models.EventType, eventId: string, options?: Models.EventsGetOptionalParams): Promise; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param eventType The type of events to query; either a standard event type (`traces`, + * `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or + * `$all` to query across all event types. Possible values include: '$all', 'traces', + * 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', + * 'availabilityResults', 'performanceCounters', 'customMetrics' + * @param eventId ID of event. + * @param callback The callback + */ + get(appId: string, eventType: Models.EventType, eventId: string, callback: msRest.ServiceCallback): void; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param eventType The type of events to query; either a standard event type (`traces`, + * `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, `availabilityResults`) or + * `$all` to query across all event types. Possible values include: '$all', 'traces', + * 'customEvents', 'pageViews', 'browserTimings', 'requests', 'dependencies', 'exceptions', + * 'availabilityResults', 'performanceCounters', 'customMetrics' + * @param eventId ID of event. + * @param options The optional parameters + * @param callback The callback + */ + get(appId: string, eventType: Models.EventType, eventId: string, options: Models.EventsGetOptionalParams, callback: msRest.ServiceCallback): void; + get(appId: string, eventType: Models.EventType, eventId: string, options?: Models.EventsGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + appId, + eventType, + eventId, + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getByTypeOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "v1/apps/{appId}/events/{eventType}", + urlParameters: [ + Parameters.appId, + Parameters.eventType + ], + queryParameters: [ + Parameters.timespan, + Parameters.filter1, + Parameters.search, + Parameters.orderby1, + Parameters.select, + Parameters.skip, + Parameters.top1, + Parameters.format, + Parameters.count, + Parameters.apply + ], + responses: { + 200: { + bodyMapper: Mappers.EventsResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "v1/apps/{appId}/events/{eventType}/{eventId}", + urlParameters: [ + Parameters.appId, + Parameters.eventType, + Parameters.eventId + ], + queryParameters: [ + Parameters.timespan + ], + responses: { + 200: { + bodyMapper: Mappers.EventsResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/operations/index.ts b/sdk/applicationinsights/applicationinsights-query/lib/operations/index.ts new file mode 100644 index 000000000000..0a63b995a17a --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/operations/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export * from "./metrics"; +export * from "./events"; +export * from "./query"; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/operations/metrics.ts b/sdk/applicationinsights/applicationinsights-query/lib/operations/metrics.ts new file mode 100644 index 000000000000..14f5da59bacc --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/operations/metrics.ts @@ -0,0 +1,263 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/metricsMappers"; +import * as Parameters from "../models/parameters"; +import { ApplicationInsightsDataClientContext } from "../applicationInsightsDataClientContext"; + +/** Class representing a Metrics. */ +export class Metrics { + private readonly client: ApplicationInsightsDataClientContext; + + /** + * Create a Metrics. + * @param {ApplicationInsightsDataClientContext} client Reference to the service client. + */ + constructor(client: ApplicationInsightsDataClientContext) { + this.client = client; + } + + /** + * Gets metric values for a single metric + * @summary Retrieve metric data + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param metricId ID of the metric. This is either a standard AI metric, or an + * application-specific custom metric. Possible values include: 'requests/count', + * 'requests/duration', 'requests/failed', 'users/count', 'users/authenticated', 'pageViews/count', + * 'pageViews/duration', 'client/processingDuration', 'client/receiveDuration', + * 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', 'dependencies/count', + * 'dependencies/failed', 'dependencies/duration', 'exceptions/count', 'exceptions/browser', + * 'exceptions/server', 'sessions/count', 'performanceCounters/requestExecutionTime', + * 'performanceCounters/requestsPerSecond', 'performanceCounters/requestsInQueue', + * 'performanceCounters/memoryAvailableBytes', 'performanceCounters/exceptionsPerSecond', + * 'performanceCounters/processCpuPercentage', 'performanceCounters/processIOBytesPerSecond', + * 'performanceCounters/processPrivateBytes', 'performanceCounters/processorCpuPercentage', + * 'availabilityResults/availabilityPercentage', 'availabilityResults/duration', + * 'billing/telemetryCount', 'customEvents/count' + * @param [options] The optional parameters + * @returns Promise + */ + get(appId: string, metricId: Models.MetricId, options?: Models.MetricsGetOptionalParams): Promise; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param metricId ID of the metric. This is either a standard AI metric, or an + * application-specific custom metric. Possible values include: 'requests/count', + * 'requests/duration', 'requests/failed', 'users/count', 'users/authenticated', 'pageViews/count', + * 'pageViews/duration', 'client/processingDuration', 'client/receiveDuration', + * 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', 'dependencies/count', + * 'dependencies/failed', 'dependencies/duration', 'exceptions/count', 'exceptions/browser', + * 'exceptions/server', 'sessions/count', 'performanceCounters/requestExecutionTime', + * 'performanceCounters/requestsPerSecond', 'performanceCounters/requestsInQueue', + * 'performanceCounters/memoryAvailableBytes', 'performanceCounters/exceptionsPerSecond', + * 'performanceCounters/processCpuPercentage', 'performanceCounters/processIOBytesPerSecond', + * 'performanceCounters/processPrivateBytes', 'performanceCounters/processorCpuPercentage', + * 'availabilityResults/availabilityPercentage', 'availabilityResults/duration', + * 'billing/telemetryCount', 'customEvents/count' + * @param callback The callback + */ + get(appId: string, metricId: Models.MetricId, callback: msRest.ServiceCallback): void; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param metricId ID of the metric. This is either a standard AI metric, or an + * application-specific custom metric. Possible values include: 'requests/count', + * 'requests/duration', 'requests/failed', 'users/count', 'users/authenticated', 'pageViews/count', + * 'pageViews/duration', 'client/processingDuration', 'client/receiveDuration', + * 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', 'dependencies/count', + * 'dependencies/failed', 'dependencies/duration', 'exceptions/count', 'exceptions/browser', + * 'exceptions/server', 'sessions/count', 'performanceCounters/requestExecutionTime', + * 'performanceCounters/requestsPerSecond', 'performanceCounters/requestsInQueue', + * 'performanceCounters/memoryAvailableBytes', 'performanceCounters/exceptionsPerSecond', + * 'performanceCounters/processCpuPercentage', 'performanceCounters/processIOBytesPerSecond', + * 'performanceCounters/processPrivateBytes', 'performanceCounters/processorCpuPercentage', + * 'availabilityResults/availabilityPercentage', 'availabilityResults/duration', + * 'billing/telemetryCount', 'customEvents/count' + * @param options The optional parameters + * @param callback The callback + */ + get(appId: string, metricId: Models.MetricId, options: Models.MetricsGetOptionalParams, callback: msRest.ServiceCallback): void; + get(appId: string, metricId: Models.MetricId, options?: Models.MetricsGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + appId, + metricId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Gets metric values for multiple metrics + * @summary Retrieve metric data + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param body The batched metrics query. + * @param [options] The optional parameters + * @returns Promise + */ + getMultiple(appId: string, body: Models.MetricsPostBodySchema[], options?: msRest.RequestOptionsBase): Promise; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param body The batched metrics query. + * @param callback The callback + */ + getMultiple(appId: string, body: Models.MetricsPostBodySchema[], callback: msRest.ServiceCallback): void; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param body The batched metrics query. + * @param options The optional parameters + * @param callback The callback + */ + getMultiple(appId: string, body: Models.MetricsPostBodySchema[], options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getMultiple(appId: string, body: Models.MetricsPostBodySchema[], options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + appId, + body, + options + }, + getMultipleOperationSpec, + callback) as Promise; + } + + /** + * Gets metadata describing the available metrics + * @summary Retrieve metric metadata + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param [options] The optional parameters + * @returns Promise + */ + getMetadata(appId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param callback The callback + */ + getMetadata(appId: string, callback: msRest.ServiceCallback): void; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param options The optional parameters + * @param callback The callback + */ + getMetadata(appId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getMetadata(appId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + appId, + options + }, + getMetadataOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "v1/apps/{appId}/metrics/{metricId}", + urlParameters: [ + Parameters.appId, + Parameters.metricId + ], + queryParameters: [ + Parameters.timespan, + Parameters.interval, + Parameters.aggregation, + Parameters.segment, + Parameters.top0, + Parameters.orderby0, + Parameters.filter0 + ], + responses: { + 200: { + bodyMapper: Mappers.MetricsResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getMultipleOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "v1/apps/{appId}/metrics", + urlParameters: [ + Parameters.appId + ], + requestBody: { + parameterPath: "body", + mapper: { + required: true, + serializedName: "body", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricsPostBodySchema" + } + } + } + } + }, + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricsResultsItem" + } + } + } + } + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getMetadataOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "v1/apps/{appId}/metrics/metadata", + urlParameters: [ + Parameters.appId + ], + responses: { + 200: { + bodyMapper: { + serializedName: "parsedResponse", + type: { + name: "Object" + } + } + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/applicationinsights/applicationinsights-query/lib/operations/query.ts b/sdk/applicationinsights/applicationinsights-query/lib/operations/query.ts new file mode 100644 index 000000000000..2a3420a07463 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/lib/operations/query.ts @@ -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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/queryMappers"; +import * as Parameters from "../models/parameters"; +import { ApplicationInsightsDataClientContext } from "../applicationInsightsDataClientContext"; + +/** Class representing a Query. */ +export class Query { + private readonly client: ApplicationInsightsDataClientContext; + + /** + * Create a Query. + * @param {ApplicationInsightsDataClientContext} client Reference to the service client. + */ + constructor(client: ApplicationInsightsDataClientContext) { + this.client = client; + } + + /** + * Executes an Analytics query for data. + * [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) is an example for + * using POST with an Analytics query. + * @summary Execute an Analytics query + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query + * syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @param [options] The optional parameters + * @returns Promise + */ + execute(appId: string, body: Models.QueryBody, options?: msRest.RequestOptionsBase): Promise; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query + * syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @param callback The callback + */ + execute(appId: string, body: Models.QueryBody, callback: msRest.ServiceCallback): void; + /** + * @param appId ID of the application. This is Application ID from the API Access settings blade in + * the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query + * syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @param options The optional parameters + * @param callback The callback + */ + execute(appId: string, body: Models.QueryBody, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + execute(appId: string, body: Models.QueryBody, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + appId, + body, + options + }, + executeOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const executeOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "v1/apps/{appId}/query", + urlParameters: [ + Parameters.appId + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.QueryBody, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.QueryResults + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/applicationinsights/applicationinsights-query/package.json b/sdk/applicationinsights/applicationinsights-query/package.json new file mode 100644 index 000000000000..b03cf4b7d3c0 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/package.json @@ -0,0 +1,55 @@ +{ + "name": "@azure/applicationinsights-query", + "author": "Microsoft Corporation", + "description": "ApplicationInsightsDataClient Library with typescript type definitions for node.js and browser.", + "version": "1.1.0", + "dependencies": { + "@azure/ms-rest-js": "^1.2.0", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/applicationinsights-query.js", + "module": "./esm/applicationInsightsDataClient.js", + "types": "./esm/applicationInsightsDataClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/applicationinsights-query.js.map'\" -o ./dist/applicationinsights-query.min.js ./dist/applicationinsights-query.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false +} diff --git a/sdk/applicationinsights/applicationinsights-query/rollup.config.js b/sdk/applicationinsights/applicationinsights-query/rollup.config.js new file mode 100644 index 000000000000..39d2dddfc433 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/applicationInsightsDataClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/applicationinsights-query.js", + format: "umd", + name: "Azure.ApplicationinsightsQuery", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */` + }, + plugins: [ + nodeResolve({ module: true }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/applicationinsights/applicationinsights-query/tsconfig.json b/sdk/applicationinsights/applicationinsights-query/tsconfig.json new file mode 100644 index 000000000000..51ea90961ce5 --- /dev/null +++ b/sdk/applicationinsights/applicationinsights-query/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./lib/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/sdk/commerce/arm-commerce/LICENSE.txt b/sdk/commerce/arm-commerce/LICENSE.txt new file mode 100644 index 000000000000..b73b4a1293c3 --- /dev/null +++ b/sdk/commerce/arm-commerce/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/commerce/arm-commerce/README.md b/sdk/commerce/arm-commerce/README.md new file mode 100644 index 000000000000..4d509d37e691 --- /dev/null +++ b/sdk/commerce/arm-commerce/README.md @@ -0,0 +1,106 @@ +## Azure UsageManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for UsageManagementClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-commerce +``` + +### How to use + +#### nodejs - Authentication, client creation and list usageAggregates as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { UsageManagementClient, UsageManagementModels, UsageManagementMappers } from "@azure/arm-commerce"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new UsageManagementClient(creds, subscriptionId); + const reportedStartTime = new Date().toISOString(); + const reportedEndTime = new Date().toISOString(); + const showDetails = true; + const aggregationGranularity = "Daily"; + const continuationToken = "testcontinuationToken"; + client.usageAggregates.list(reportedStartTime, reportedEndTime, showDetails, aggregationGranularity, continuationToken).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list usageAggregates as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-commerce sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/sdk/commerce/arm-commerce/lib/models/index.ts b/sdk/commerce/arm-commerce/lib/models/index.ts new file mode 100644 index 000000000000..f9ba948659c4 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/models/index.ts @@ -0,0 +1,479 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export { BaseResource, CloudError }; + + +/** + * @interface + * An interface representing InfoField. + * Key-value pairs of instance details in the legacy format. + * + */ +export interface InfoField { + /** + * @member {string} [project] Identifies the name of the instance provisioned + * by the user. + */ + project?: string; +} + +/** + * @interface + * An interface representing UsageAggregation. + * Describes the usageAggregation. + * + */ +export interface UsageAggregation { + /** + * @member {string} [id] Unique Id for the usage aggregate. + */ + id?: string; + /** + * @member {string} [name] Name of the usage aggregate. + */ + name?: string; + /** + * @member {string} [type] Type of the resource being returned. + */ + type?: string; + /** + * @member {string} [subscriptionId] The subscription identifier for the + * Azure user. + */ + subscriptionId?: string; + /** + * @member {string} [meterId] Unique ID for the resource that was consumed + * (aka ResourceID). + */ + meterId?: string; + /** + * @member {Date} [usageStartTime] UTC start time for the usage bucket to + * which this usage aggregate belongs. + */ + usageStartTime?: Date; + /** + * @member {Date} [usageEndTime] UTC end time for the usage bucket to which + * this usage aggregate belongs. + */ + usageEndTime?: Date; + /** + * @member {number} [quantity] The amount of the resource consumption that + * occurred in this time frame. + */ + quantity?: number; + /** + * @member {string} [unit] The unit in which the usage for this resource is + * being counted, e.g. Hours, GB. + */ + unit?: string; + /** + * @member {string} [meterName] Friendly name of the resource being consumed. + */ + meterName?: string; + /** + * @member {string} [meterCategory] Category of the consumed resource. + */ + meterCategory?: string; + /** + * @member {string} [meterSubCategory] Sub-category of the consumed resource. + */ + meterSubCategory?: string; + /** + * @member {string} [meterRegion] Region of the meterId used for billing + * purposes + */ + meterRegion?: string; + /** + * @member {InfoField} [infoFields] Key-value pairs of instance details + * (legacy format). + */ + infoFields?: InfoField; + /** + * @member {string} [instanceData] Key-value pairs of instance details + * represented as a string. + */ + instanceData?: string; +} + +/** + * @interface + * An interface representing RateCardQueryParameters. + * Parameters that are used in the odata $filter query parameter for providing + * RateCard information. + * + */ +export interface RateCardQueryParameters { + /** + * @member {string} offerDurableId The Offer ID parameter consists of the + * 'MS-AZR-' prefix, plus the Offer ID number (e.g., MS-AZR-0026P). See + * https://azure.microsoft.com/en-us/support/legal/offer-details/ for more + * information on the list of available Offer IDs, country/region + * availability, and billing currency. + */ + offerDurableId: string; + /** + * @member {string} currency The currency in which the rates need to be + * provided. + */ + currency: string; + /** + * @member {string} locale The culture in which the resource metadata needs + * to be localized. + */ + locale: string; + /** + * @member {string} regionInfo 2 letter ISO code where the offer was + * purchased. + */ + regionInfo: string; +} + +/** + * Contains the possible cases for OfferTermInfo. + */ +export type OfferTermInfoUnion = OfferTermInfo | MonetaryCredit | MonetaryCommitment | RecurringCharge; + +/** + * @interface + * An interface representing OfferTermInfo. + * Describes the offer term. + * + */ +export interface OfferTermInfo { + /** + * @member {string} name Polymorphic Discriminator + */ + name: "OfferTermInfo"; + /** + * @member {Date} [effectiveDate] Indicates the date from which the offer + * term is effective. + */ + effectiveDate?: Date; +} + +/** + * @interface + * An interface representing MeterInfo. + * Detailed information about the meter. + * + */ +export interface MeterInfo { + /** + * @member {string} [meterId] The unique identifier of the resource. + */ + meterId?: string; + /** + * @member {string} [meterName] The name of the meter, within the given meter + * category + */ + meterName?: string; + /** + * @member {string} [meterCategory] The category of the meter, e.g., 'Cloud + * services', 'Networking', etc.. + */ + meterCategory?: string; + /** + * @member {string} [meterSubCategory] The subcategory of the meter, e.g., + * 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. + */ + meterSubCategory?: string; + /** + * @member {string} [unit] The unit in which the meter consumption is + * charged, e.g., 'Hours', 'GB', etc. + */ + unit?: string; + /** + * @member {string[]} [meterTags] Provides additional meter data. 'Third + * Party' indicates a meter with no discount. Blanks indicate First Party. + */ + meterTags?: string[]; + /** + * @member {string} [meterRegion] The region in which the Azure service is + * available. + */ + meterRegion?: string; + /** + * @member {{ [propertyName: string]: number }} [meterRates] The list of + * key/value pairs for the meter rates, in the format 'key':'value' where key + * = the meter quantity, and value = the corresponding price + */ + meterRates?: { [propertyName: string]: number }; + /** + * @member {Date} [effectiveDate] Indicates the date from which the meter + * rate is effective. + */ + effectiveDate?: Date; + /** + * @member {number} [includedQuantity] The resource quantity that is included + * in the offer at no cost. Consumption beyond this quantity will be charged. + */ + includedQuantity?: number; +} + +/** + * @interface + * An interface representing ResourceRateCardInfo. + * Price and Metadata information for resources + * + */ +export interface ResourceRateCardInfo { + /** + * @member {string} [currency] The currency in which the rates are provided. + */ + currency?: string; + /** + * @member {string} [locale] The culture in which the resource information is + * localized. + */ + locale?: string; + /** + * @member {boolean} [isTaxIncluded] All rates are pretax, so this will + * always be returned as 'false'. + */ + isTaxIncluded?: boolean; + /** + * @member {OfferTermInfoUnion[]} [offerTerms] A list of offer terms. + */ + offerTerms?: OfferTermInfoUnion[]; + /** + * @member {MeterInfo[]} [meters] A list of meters. + */ + meters?: MeterInfo[]; +} + +/** + * @interface + * An interface representing MonetaryCredit. + * Indicates that this is a monetary credit offer. + * + */ +export interface MonetaryCredit { + /** + * @member {string} name Polymorphic Discriminator + */ + name: "Monetary Credit"; + /** + * @member {Date} [effectiveDate] Indicates the date from which the offer + * term is effective. + */ + effectiveDate?: Date; + /** + * @member {number} [credit] The amount of credit provided under the terms of + * the given offer level. + */ + credit?: number; + /** + * @member {string[]} [excludedMeterIds] An array of meter ids that are + * excluded from the given offer terms. + */ + excludedMeterIds?: string[]; +} + +/** + * @interface + * An interface representing MonetaryCommitment. + * Indicates that a monetary commitment is required for this offer + * + */ +export interface MonetaryCommitment { + /** + * @member {string} name Polymorphic Discriminator + */ + name: "Monetary Commitment"; + /** + * @member {Date} [effectiveDate] Indicates the date from which the offer + * term is effective. + */ + effectiveDate?: Date; + /** + * @member {{ [propertyName: string]: number }} [tieredDiscount] The list of + * key/value pairs for the tiered meter rates, in the format 'key':'value' + * where key = price, and value = the corresponding discount percentage. This + * field is used only by offer terms of type 'Monetary Commitment'. + */ + tieredDiscount?: { [propertyName: string]: number }; + /** + * @member {string[]} [excludedMeterIds] An array of meter ids that are + * excluded from the given offer terms. + */ + excludedMeterIds?: string[]; +} + +/** + * @interface + * An interface representing RecurringCharge. + * Indicates a recurring charge is present for this offer. + * + */ +export interface RecurringCharge { + /** + * @member {string} name Polymorphic Discriminator + */ + name: "Recurring Charge"; + /** + * @member {Date} [effectiveDate] Indicates the date from which the offer + * term is effective. + */ + effectiveDate?: Date; + /** + * @member {number} [recurringCharge] The amount of recurring charge as per + * the offer term. + */ + recurringCharge?: number; +} + +/** + * @interface + * An interface representing ErrorResponse. + * Describes the format of Error response. + * + */ +export interface ErrorResponse { + /** + * @member {string} [code] Error code + */ + code?: string; + /** + * @member {string} [message] Error message indicating why the operation + * failed. + */ + message?: string; +} + +/** + * @interface + * An interface representing UsageAggregatesListOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface UsageAggregatesListOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {boolean} [showDetails] `True` returns usage data in + * instance-level detail, `false` causes server-side aggregation with fewer + * details. For example, if you have 3 website instances, by default you will + * get 3 line items for website consumption. If you specify showDetails = + * false, the data will be aggregated as a single line item for website + * consumption within the time period (for the given subscriptionId, meterId, + * usageStartTime and usageEndTime). + */ + showDetails?: boolean; + /** + * @member {AggregationGranularity} [aggregationGranularity] `Daily` + * (default) returns the data in daily granularity, `Hourly` returns the data + * in hourly granularity. Possible values include: 'Daily', 'Hourly'. Default + * value: 'Daily' . + */ + aggregationGranularity?: AggregationGranularity; + /** + * @member {string} [continuationToken] Used when a continuation token string + * is provided in the response body of the previous call, enabling paging + * through a large result set. If not present, the data is retrieved from the + * beginning of the day/hour (based on the granularity) passed in. + */ + continuationToken?: string; +} + +/** + * @interface + * An interface representing UsageManagementClientOptions. + * @extends AzureServiceClientOptions + */ +export interface UsageManagementClientOptions extends AzureServiceClientOptions { + /** + * @member {string} [baseUri] + */ + baseUri?: string; +} + + +/** + * @interface + * An interface representing the UsageAggregationListResult. + * The Get UsageAggregates operation response. + * + * @extends Array + */ +export interface UsageAggregationListResult extends Array { + /** + * @member {string} [nextLink] Gets or sets the link to the next set of + * results. + */ + nextLink?: string; +} + +/** + * Defines values for AggregationGranularity. + * Possible values include: 'Daily', 'Hourly' + * @readonly + * @enum {string} + */ +export type AggregationGranularity = 'Daily' | 'Hourly'; + +/** + * Contains response data for the list operation. + */ +export type UsageAggregatesListResponse = UsageAggregationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: UsageAggregationListResult; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type UsageAggregatesListNextResponse = UsageAggregationListResult & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: UsageAggregationListResult; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type RateCardGetResponse = ResourceRateCardInfo & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ResourceRateCardInfo; + }; +}; diff --git a/sdk/commerce/arm-commerce/lib/models/mappers.ts b/sdk/commerce/arm-commerce/lib/models/mappers.ts new file mode 100644 index 000000000000..d35dd7532add --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/models/mappers.ts @@ -0,0 +1,474 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; +import * as msRest from "@azure/ms-rest-js"; + +export const CloudError = CloudErrorMapper; +export const BaseResource = BaseResourceMapper; + +export const InfoField: msRest.CompositeMapper = { + serializedName: "InfoField", + type: { + name: "Composite", + className: "InfoField", + modelProperties: { + project: { + serializedName: "project", + type: { + name: "String" + } + } + } + } +}; + +export const UsageAggregation: msRest.CompositeMapper = { + serializedName: "UsageAggregation", + type: { + name: "Composite", + className: "UsageAggregation", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + subscriptionId: { + serializedName: "properties.subscriptionId", + type: { + name: "Uuid" + } + }, + meterId: { + serializedName: "properties.meterId", + type: { + name: "String" + } + }, + usageStartTime: { + serializedName: "properties.usageStartTime", + type: { + name: "DateTime" + } + }, + usageEndTime: { + serializedName: "properties.usageEndTime", + type: { + name: "DateTime" + } + }, + quantity: { + serializedName: "properties.quantity", + type: { + name: "Number" + } + }, + unit: { + serializedName: "properties.unit", + type: { + name: "String" + } + }, + meterName: { + serializedName: "properties.meterName", + type: { + name: "String" + } + }, + meterCategory: { + serializedName: "properties.meterCategory", + type: { + name: "String" + } + }, + meterSubCategory: { + serializedName: "properties.meterSubCategory", + type: { + name: "String" + } + }, + meterRegion: { + serializedName: "properties.meterRegion", + type: { + name: "String" + } + }, + infoFields: { + serializedName: "properties.infoFields", + type: { + name: "Composite", + className: "InfoField" + } + }, + instanceData: { + serializedName: "properties.instanceData", + type: { + name: "String" + } + } + } + } +}; + +export const RateCardQueryParameters: msRest.CompositeMapper = { + serializedName: "RateCardQueryParameters", + type: { + name: "Composite", + className: "RateCardQueryParameters", + modelProperties: { + offerDurableId: { + required: true, + serializedName: "OfferDurableId", + constraints: { + Pattern: /^MS-AZR-\d{4}P(-\d{4}P)*$/ + }, + type: { + name: "String" + } + }, + currency: { + required: true, + serializedName: "Currency", + type: { + name: "String" + } + }, + locale: { + required: true, + serializedName: "Locale", + type: { + name: "String" + } + }, + regionInfo: { + required: true, + serializedName: "RegionInfo", + type: { + name: "String" + } + } + } + } +}; + +export const OfferTermInfo: msRest.CompositeMapper = { + serializedName: "OfferTermInfo", + type: { + name: "Composite", + polymorphicDiscriminator: { + serializedName: "Name", + clientName: "name" + }, + uberParent: "OfferTermInfo", + className: "OfferTermInfo", + modelProperties: { + effectiveDate: { + serializedName: "EffectiveDate", + type: { + name: "DateTime" + } + }, + name: { + required: true, + serializedName: "Name", + type: { + name: "String" + } + } + } + } +}; + +export const MeterInfo: msRest.CompositeMapper = { + serializedName: "MeterInfo", + type: { + name: "Composite", + className: "MeterInfo", + modelProperties: { + meterId: { + serializedName: "MeterId", + type: { + name: "Uuid" + } + }, + meterName: { + serializedName: "MeterName", + type: { + name: "String" + } + }, + meterCategory: { + serializedName: "MeterCategory", + type: { + name: "String" + } + }, + meterSubCategory: { + serializedName: "MeterSubCategory", + type: { + name: "String" + } + }, + unit: { + serializedName: "Unit", + type: { + name: "String" + } + }, + meterTags: { + serializedName: "MeterTags", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + meterRegion: { + serializedName: "MeterRegion", + type: { + name: "String" + } + }, + meterRates: { + serializedName: "MeterRates", + type: { + name: "Dictionary", + value: { + type: { + name: "Number" + } + } + } + }, + effectiveDate: { + serializedName: "EffectiveDate", + type: { + name: "DateTime" + } + }, + includedQuantity: { + serializedName: "IncludedQuantity", + type: { + name: "Number" + } + } + } + } +}; + +export const ResourceRateCardInfo: msRest.CompositeMapper = { + serializedName: "ResourceRateCardInfo", + type: { + name: "Composite", + className: "ResourceRateCardInfo", + modelProperties: { + currency: { + serializedName: "Currency", + type: { + name: "String" + } + }, + locale: { + serializedName: "Locale", + type: { + name: "String" + } + }, + isTaxIncluded: { + serializedName: "IsTaxIncluded", + type: { + name: "Boolean" + } + }, + offerTerms: { + serializedName: "OfferTerms", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OfferTermInfo" + } + } + } + }, + meters: { + serializedName: "Meters", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MeterInfo" + } + } + } + } + } + } +}; + +export const MonetaryCredit: msRest.CompositeMapper = { + serializedName: "Monetary Credit", + type: { + name: "Composite", + polymorphicDiscriminator: OfferTermInfo.type.polymorphicDiscriminator, + uberParent: "OfferTermInfo", + className: "MonetaryCredit", + modelProperties: { + ...OfferTermInfo.type.modelProperties, + credit: { + serializedName: "Credit", + type: { + name: "Number" + } + }, + excludedMeterIds: { + serializedName: "ExcludedMeterIds", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + } +}; + +export const MonetaryCommitment: msRest.CompositeMapper = { + serializedName: "Monetary Commitment", + type: { + name: "Composite", + polymorphicDiscriminator: OfferTermInfo.type.polymorphicDiscriminator, + uberParent: "OfferTermInfo", + className: "MonetaryCommitment", + modelProperties: { + ...OfferTermInfo.type.modelProperties, + tieredDiscount: { + serializedName: "TieredDiscount", + type: { + name: "Dictionary", + value: { + type: { + name: "Number" + } + } + } + }, + excludedMeterIds: { + serializedName: "ExcludedMeterIds", + type: { + name: "Sequence", + element: { + type: { + name: "Uuid" + } + } + } + } + } + } +}; + +export const RecurringCharge: msRest.CompositeMapper = { + serializedName: "Recurring Charge", + type: { + name: "Composite", + polymorphicDiscriminator: OfferTermInfo.type.polymorphicDiscriminator, + uberParent: "OfferTermInfo", + className: "RecurringCharge", + modelProperties: { + ...OfferTermInfo.type.modelProperties, + recurringCharge: { + serializedName: "RecurringCharge", + type: { + name: "Number" + } + } + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const UsageAggregationListResult: msRest.CompositeMapper = { + serializedName: "UsageAggregationListResult", + type: { + name: "Composite", + className: "UsageAggregationListResult", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UsageAggregation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const discriminators = { + 'OfferTermInfo' : OfferTermInfo, + 'OfferTermInfo.Monetary Credit' : MonetaryCredit, + 'OfferTermInfo.Monetary Commitment' : MonetaryCommitment, + 'OfferTermInfo.Recurring Charge' : RecurringCharge +}; diff --git a/sdk/commerce/arm-commerce/lib/models/parameters.ts b/sdk/commerce/arm-commerce/lib/models/parameters.ts new file mode 100644 index 000000000000..20a436455b21 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/models/parameters.ts @@ -0,0 +1,124 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * 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 * as msRest from "@azure/ms-rest-js"; + +export const acceptLanguage: msRest.OperationParameter = { + parameterPath: "acceptLanguage", + mapper: { + serializedName: "accept-language", + defaultValue: 'en-US', + type: { + name: "String" + } + } +}; +export const aggregationGranularity: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "aggregationGranularity" + ], + mapper: { + serializedName: "aggregationGranularity", + defaultValue: 'Daily', + type: { + name: "Enum", + allowedValues: [ + "Daily", + "Hourly" + ] + } + } +}; +export const apiVersion: msRest.OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + required: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; +export const continuationToken: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "continuationToken" + ], + mapper: { + serializedName: "continuationToken", + type: { + name: "String" + } + } +}; +export const filter: msRest.OperationQueryParameter = { + parameterPath: "filter", + mapper: { + required: true, + serializedName: "$filter", + type: { + name: "String" + } + } +}; +export const nextPageLink: msRest.OperationURLParameter = { + parameterPath: "nextPageLink", + mapper: { + required: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const reportedEndTime: msRest.OperationQueryParameter = { + parameterPath: "reportedEndTime", + mapper: { + required: true, + serializedName: "reportedEndTime", + type: { + name: "DateTime" + } + } +}; +export const reportedStartTime: msRest.OperationQueryParameter = { + parameterPath: "reportedStartTime", + mapper: { + required: true, + serializedName: "reportedStartTime", + type: { + name: "DateTime" + } + } +}; +export const showDetails: msRest.OperationQueryParameter = { + parameterPath: [ + "options", + "showDetails" + ], + mapper: { + serializedName: "showDetails", + type: { + name: "Boolean" + } + } +}; +export const subscriptionId: msRest.OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + required: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + } +}; diff --git a/sdk/commerce/arm-commerce/lib/models/rateCardMappers.ts b/sdk/commerce/arm-commerce/lib/models/rateCardMappers.ts new file mode 100644 index 000000000000..7be716abd051 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/models/rateCardMappers.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + ResourceRateCardInfo, + OfferTermInfo, + MeterInfo, + ErrorResponse, + MonetaryCredit, + MonetaryCommitment, + RecurringCharge +} from "../models/mappers"; + diff --git a/sdk/commerce/arm-commerce/lib/models/usageAggregatesMappers.ts b/sdk/commerce/arm-commerce/lib/models/usageAggregatesMappers.ts new file mode 100644 index 000000000000..a6537c2d3c95 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/models/usageAggregatesMappers.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + UsageAggregationListResult, + UsageAggregation, + InfoField, + ErrorResponse +} from "../models/mappers"; + diff --git a/sdk/commerce/arm-commerce/lib/operations/index.ts b/sdk/commerce/arm-commerce/lib/operations/index.ts new file mode 100644 index 000000000000..fc774b66d368 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export * from "./usageAggregates"; +export * from "./rateCard"; diff --git a/sdk/commerce/arm-commerce/lib/operations/rateCard.ts b/sdk/commerce/arm-commerce/lib/operations/rateCard.ts new file mode 100644 index 000000000000..698888d775ad --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/operations/rateCard.ts @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/rateCardMappers"; +import * as Parameters from "../models/parameters"; +import { UsageManagementClientContext } from "../usageManagementClientContext"; + +/** Class representing a RateCard. */ +export class RateCard { + private readonly client: UsageManagementClientContext; + + /** + * Create a RateCard. + * @param {UsageManagementClientContext} client Reference to the service client. + */ + constructor(client: UsageManagementClientContext) { + this.client = client; + } + + /** + * Enables you to query for the resource/meter metadata and related prices used in a given + * subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing + * meters, including but not limited to service names, types, resources, units of measure, and + * regions, is subject to change at any time and without notice. If you intend to use this billing + * data in an automated fashion, please use the billing meter GUID to uniquely identify each + * billable item. If the billing meter GUID is scheduled to change due to a new billing model, you + * will be notified in advance of the change. + * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical + * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', + * 'Region' are required to be a part of the $filter. + * @param [options] The optional parameters + * @returns Promise + */ + get(filter: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical + * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', + * 'Region' are required to be a part of the $filter. + * @param callback The callback + */ + get(filter: string, callback: msRest.ServiceCallback): void; + /** + * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical + * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', + * 'Region' are required to be a part of the $filter. + * @param options The optional parameters + * @param callback The callback + */ + get(filter: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(filter: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + filter, + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.filter, + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ResourceRateCardInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/commerce/arm-commerce/lib/operations/usageAggregates.ts b/sdk/commerce/arm-commerce/lib/operations/usageAggregates.ts new file mode 100644 index 000000000000..d7f83c33bac2 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/operations/usageAggregates.ts @@ -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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/usageAggregatesMappers"; +import * as Parameters from "../models/parameters"; +import { UsageManagementClientContext } from "../usageManagementClientContext"; + +/** Class representing a UsageAggregates. */ +export class UsageAggregates { + private readonly client: UsageManagementClientContext; + + /** + * Create a UsageAggregates. + * @param {UsageManagementClientContext} client Reference to the service client. + */ + constructor(client: UsageManagementClientContext) { + this.client = client; + } + + /** + * Query aggregated Azure subscription consumption data for a date range. + * @param reportedStartTime The start of the time range to retrieve data for. + * @param reportedEndTime The end of the time range to retrieve data for. + * @param [options] The optional parameters + * @returns Promise + */ + list(reportedStartTime: Date | string, reportedEndTime: Date | string, options?: Models.UsageAggregatesListOptionalParams): Promise; + /** + * @param reportedStartTime The start of the time range to retrieve data for. + * @param reportedEndTime The end of the time range to retrieve data for. + * @param callback The callback + */ + list(reportedStartTime: Date | string, reportedEndTime: Date | string, callback: msRest.ServiceCallback): void; + /** + * @param reportedStartTime The start of the time range to retrieve data for. + * @param reportedEndTime The end of the time range to retrieve data for. + * @param options The optional parameters + * @param callback The callback + */ + list(reportedStartTime: Date | string, reportedEndTime: Date | string, options: Models.UsageAggregatesListOptionalParams, callback: msRest.ServiceCallback): void; + list(reportedStartTime: Date | string, reportedEndTime: Date | string, options?: Models.UsageAggregatesListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + reportedStartTime, + reportedEndTime, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Query aggregated Azure subscription consumption data for a date range. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.reportedStartTime, + Parameters.reportedEndTime, + Parameters.showDetails, + Parameters.aggregationGranularity, + Parameters.continuationToken, + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.UsageAggregationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.UsageAggregationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/commerce/arm-commerce/lib/usageManagementClient.ts b/sdk/commerce/arm-commerce/lib/usageManagementClient.ts new file mode 100644 index 000000000000..14140e6bff74 --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/usageManagementClient.ts @@ -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 * as msRest from "@azure/ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { UsageManagementClientContext } from "./usageManagementClientContext"; + + +class UsageManagementClient extends UsageManagementClientContext { + // Operation groups + usageAggregates: operations.UsageAggregates; + rateCard: operations.RateCard; + + /** + * Initializes a new instance of the UsageManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.UsageManagementClientOptions) { + super(credentials, subscriptionId, options); + this.usageAggregates = new operations.UsageAggregates(this); + this.rateCard = new operations.RateCard(this); + } +} + +// Operation Specifications + +export { + UsageManagementClient, + UsageManagementClientContext, + Models as UsageManagementModels, + Mappers as UsageManagementMappers +}; +export * from "./operations"; diff --git a/sdk/commerce/arm-commerce/lib/usageManagementClientContext.ts b/sdk/commerce/arm-commerce/lib/usageManagementClientContext.ts new file mode 100644 index 000000000000..f2995a21ee7e --- /dev/null +++ b/sdk/commerce/arm-commerce/lib/usageManagementClientContext.ts @@ -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. + */ + +import * as Models from "./models"; +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; + +const packageName = "@azure/arm-commerce"; +const packageVersion = "2.1.1"; + +export class UsageManagementClientContext extends msRestAzure.AzureServiceClient { + credentials: msRest.ServiceClientCredentials; + subscriptionId: string; + apiVersion?: string; + + /** + * Initializes a new instance of the UsageManagementClient class. + * @param credentials Credentials needed for the client to connect to Azure. + * @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * @param [options] The parameter options + */ + constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.UsageManagementClientOptions) { + if (credentials == undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId == undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.apiVersion = '2015-06-01-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; + this.requestContentType = "application/json; charset=utf-8"; + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + } +} diff --git a/sdk/commerce/arm-commerce/package.json b/sdk/commerce/arm-commerce/package.json new file mode 100644 index 000000000000..a71efd3cdc9e --- /dev/null +++ b/sdk/commerce/arm-commerce/package.json @@ -0,0 +1,56 @@ +{ + "name": "@azure/arm-commerce", + "author": "Microsoft Corporation", + "description": "UsageManagementClient Library with typescript type definitions for node.js and browser.", + "version": "2.1.1", + "dependencies": { + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/arm-commerce.js", + "module": "./esm/usageManagementClient.js", + "types": "./esm/usageManagementClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-commerce.js.map'\" -o ./dist/arm-commerce.min.js ./dist/arm-commerce.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false +} diff --git a/sdk/commerce/arm-commerce/rollup.config.js b/sdk/commerce/arm-commerce/rollup.config.js new file mode 100644 index 000000000000..4dac60a49527 --- /dev/null +++ b/sdk/commerce/arm-commerce/rollup.config.js @@ -0,0 +1,37 @@ +import rollup from "rollup"; +import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + +/** + * @type {rollup.RollupFileOptions} + */ +const config = { + input: "./esm/usageManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], + output: { + file: "./dist/arm-commerce.js", + format: "umd", + name: "Azure.ArmCommerce", + sourcemap: true, + globals: { + "@azure/ms-rest-js": "msRest", + "@azure/ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */` + }, + plugins: [ + nodeResolve({ module: true }), + sourcemaps() + ] +}; + +export default config; diff --git a/sdk/commerce/arm-commerce/tsconfig.json b/sdk/commerce/arm-commerce/tsconfig.json new file mode 100644 index 000000000000..51ea90961ce5 --- /dev/null +++ b/sdk/commerce/arm-commerce/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./lib/**/*.ts"], + "exclude": ["node_modules"] +}