/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * 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 msRestAzure from "@azure/ms-rest-azure-js"; import * as Models from "../models"; import * as Mappers from "../models/logAnalyticsMappers"; import * as Parameters from "../models/parameters"; import { ComputeManagementClientContext } from "../computeManagementClientContext"; /** Class representing a LogAnalytics. */ export class LogAnalytics { private readonly client: ComputeManagementClientContext; /** * Create a LogAnalytics. * @param {ComputeManagementClientContext} client Reference to the service client. */ constructor(client: ComputeManagementClientContext) { this.client = client; } /** * Export logs that show Api requests made by this subscription in the given time window to show * throttling activities. * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. * @param location The location upon which virtual-machine-sizes is queried. * @param [options] The optional parameters * @returns Promise */ exportRequestRateByInterval(parameters: Models.RequestRateByIntervalInput, location: string, options?: msRest.RequestOptionsBase): Promise { return this.beginExportRequestRateByInterval(parameters,location,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** * Export logs that show total throttled Api requests for this subscription in the given time * window. * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. * @param location The location upon which virtual-machine-sizes is queried. * @param [options] The optional parameters * @returns Promise */ exportThrottledRequests(parameters: Models.ThrottledRequestsInput, location: string, options?: msRest.RequestOptionsBase): Promise { return this.beginExportThrottledRequests(parameters,location,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** * Export logs that show Api requests made by this subscription in the given time window to show * throttling activities. * @param parameters Parameters supplied to the LogAnalytics getRequestRateByInterval Api. * @param location The location upon which virtual-machine-sizes is queried. * @param [options] The optional parameters * @returns Promise */ beginExportRequestRateByInterval(parameters: Models.RequestRateByIntervalInput, location: string, options?: msRest.RequestOptionsBase): Promise { return this.client.sendLRORequest( { parameters, location, options }, beginExportRequestRateByIntervalOperationSpec, options); } /** * Export logs that show total throttled Api requests for this subscription in the given time * window. * @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. * @param location The location upon which virtual-machine-sizes is queried. * @param [options] The optional parameters * @returns Promise */ beginExportThrottledRequests(parameters: Models.ThrottledRequestsInput, location: string, options?: msRest.RequestOptionsBase): Promise { return this.client.sendLRORequest( { parameters, location, options }, beginExportThrottledRequestsOperationSpec, options); } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const beginExportRequestRateByIntervalOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval", urlParameters: [ Parameters.location1, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.RequestRateByIntervalInput, required: true } }, responses: { 200: { bodyMapper: Mappers.LogAnalyticsOperationResult }, 202: {}, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginExportThrottledRequestsOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests", urlParameters: [ Parameters.location1, Parameters.subscriptionId ], queryParameters: [ Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "parameters", mapper: { ...Mappers.ThrottledRequestsInput, required: true } }, responses: { 200: { bodyMapper: Mappers.LogAnalyticsOperationResult }, 202: {}, default: { bodyMapper: Mappers.CloudError } }, serializer };