UNPKG

@azure/arm-monitor

Version:
330 lines 12.8 kB
/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; /// <reference lib="esnext.asynciterable" /> /** Class containing DataCollectionRuleAssociations operations. */ export class DataCollectionRuleAssociationsImpl { /** * Initialize a new instance of the class DataCollectionRuleAssociations class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Lists associations for the specified resource. * @param resourceUri The identifier of the resource. * @param options The options parameters. */ listByResource(resourceUri, options) { const iter = this.listByResourcePagingAll(resourceUri, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listByResourcePagingPage(resourceUri, options); } }; } listByResourcePagingPage(resourceUri, options) { return __asyncGenerator(this, arguments, function* listByResourcePagingPage_1() { let result = yield __await(this._listByResource(resourceUri, options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listByResourceNext(resourceUri, continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listByResourcePagingAll(resourceUri, options) { return __asyncGenerator(this, arguments, function* listByResourcePagingAll_1() { var e_1, _a; try { for (var _b = __asyncValues(this.listByResourcePagingPage(resourceUri, options)), _c; _c = yield __await(_b.next()), !_c.done;) { const page = _c.value; yield __await(yield* __asyncDelegator(__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b)); } finally { if (e_1) throw e_1.error; } } }); } /** * Lists associations for the specified data collection rule. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. * @param options The options parameters. */ listByRule(resourceGroupName, dataCollectionRuleName, options) { const iter = this.listByRulePagingAll(resourceGroupName, dataCollectionRuleName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listByRulePagingPage(resourceGroupName, dataCollectionRuleName, options); } }; } listByRulePagingPage(resourceGroupName, dataCollectionRuleName, options) { return __asyncGenerator(this, arguments, function* listByRulePagingPage_1() { let result = yield __await(this._listByRule(resourceGroupName, dataCollectionRuleName, options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listByRuleNext(resourceGroupName, dataCollectionRuleName, continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listByRulePagingAll(resourceGroupName, dataCollectionRuleName, options) { return __asyncGenerator(this, arguments, function* listByRulePagingAll_1() { var e_2, _a; try { for (var _b = __asyncValues(this.listByRulePagingPage(resourceGroupName, dataCollectionRuleName, options)), _c; _c = yield __await(_b.next()), !_c.done;) { const page = _c.value; yield __await(yield* __asyncDelegator(__asyncValues(page))); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b)); } finally { if (e_2) throw e_2.error; } } }); } /** * Lists associations for the specified resource. * @param resourceUri The identifier of the resource. * @param options The options parameters. */ _listByResource(resourceUri, options) { return this.client.sendOperationRequest({ resourceUri, options }, listByResourceOperationSpec); } /** * Lists associations for the specified data collection rule. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. * @param options The options parameters. */ _listByRule(resourceGroupName, dataCollectionRuleName, options) { return this.client.sendOperationRequest({ resourceGroupName, dataCollectionRuleName, options }, listByRuleOperationSpec); } /** * Returns the specified association. * @param resourceUri The identifier of the resource. * @param associationName The name of the association. The name is case insensitive. * @param options The options parameters. */ get(resourceUri, associationName, options) { return this.client.sendOperationRequest({ resourceUri, associationName, options }, getOperationSpec); } /** * Creates or updates an association. * @param resourceUri The identifier of the resource. * @param associationName The name of the association. The name is case insensitive. * @param options The options parameters. */ create(resourceUri, associationName, options) { return this.client.sendOperationRequest({ resourceUri, associationName, options }, createOperationSpec); } /** * Deletes an association. * @param resourceUri The identifier of the resource. * @param associationName The name of the association. The name is case insensitive. * @param options The options parameters. */ delete(resourceUri, associationName, options) { return this.client.sendOperationRequest({ resourceUri, associationName, options }, deleteOperationSpec); } /** * ListByResourceNext * @param resourceUri The identifier of the resource. * @param nextLink The nextLink from the previous successful call to the ListByResource method. * @param options The options parameters. */ _listByResourceNext(resourceUri, nextLink, options) { return this.client.sendOperationRequest({ resourceUri, nextLink, options }, listByResourceNextOperationSpec); } /** * ListByRuleNext * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. * @param nextLink The nextLink from the previous successful call to the ListByRule method. * @param options The options parameters. */ _listByRuleNext(resourceGroupName, dataCollectionRuleName, nextLink, options) { return this.client.sendOperationRequest({ resourceGroupName, dataCollectionRuleName, nextLink, options }, listByRuleNextOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listByResourceOperationSpec = { path: "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResourceListResult }, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, queryParameters: [Parameters.apiVersion12], urlParameters: [Parameters.$host, Parameters.resourceUri1], headerParameters: [Parameters.accept], serializer }; const listByRuleOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResourceListResult }, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, queryParameters: [Parameters.apiVersion12], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.dataCollectionRuleName ], headerParameters: [Parameters.accept], serializer }; const getOperationSpec = { path: "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResource }, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, queryParameters: [Parameters.apiVersion12], urlParameters: [ Parameters.$host, Parameters.resourceUri1, Parameters.associationName ], headerParameters: [Parameters.accept], serializer }; const createOperationSpec = { path: "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResource }, 201: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResource }, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, requestBody: Parameters.body2, queryParameters: [Parameters.apiVersion12], urlParameters: [ Parameters.$host, Parameters.resourceUri1, Parameters.associationName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const deleteOperationSpec = { path: "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", httpMethod: "DELETE", responses: { 200: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, queryParameters: [Parameters.apiVersion12], urlParameters: [ Parameters.$host, Parameters.resourceUri1, Parameters.associationName ], headerParameters: [Parameters.accept], serializer }; const listByResourceNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResourceListResult }, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, queryParameters: [Parameters.apiVersion12], urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.resourceUri1 ], headerParameters: [Parameters.accept], serializer }; const listByRuleNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DataCollectionRuleAssociationProxyOnlyResourceListResult }, default: { bodyMapper: Mappers.ErrorResponseCommonV2 } }, queryParameters: [Parameters.apiVersion12], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.nextLink, Parameters.dataCollectionRuleName ], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=dataCollectionRuleAssociations.js.map