UNPKG

@azure/arm-monitor

Version:
380 lines 15.5 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, __awaiter } from "tslib"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { LroEngine } from "@azure/core-lro"; import { LroImpl } from "../lroImpl"; /// <reference lib="esnext.asynciterable" /> /** Class containing PrivateLinkScopes operations. */ export class PrivateLinkScopesImpl { /** * Initialize a new instance of the class PrivateLinkScopes class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. * @param options The options parameters. */ list(options) { const iter = this.listPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listPagingPage(options); } }; } listPagingPage(options) { return __asyncGenerator(this, arguments, function* listPagingPage_1() { let result = yield __await(this._list(options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listNext(continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listPagingAll(options) { return __asyncGenerator(this, arguments, function* listPagingAll_1() { var e_1, _a; try { for (var _b = __asyncValues(this.listPagingPage(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; } } }); } /** * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ listByResourceGroup(resourceGroupName, options) { const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listByResourceGroupPagingPage(resourceGroupName, options); } }; } listByResourceGroupPagingPage(resourceGroupName, options) { return __asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() { let result = yield __await(this._listByResourceGroup(resourceGroupName, options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listByResourceGroupPagingAll(resourceGroupName, options) { return __asyncGenerator(this, arguments, function* listByResourceGroupPagingAll_1() { var e_2, _a; try { for (var _b = __asyncValues(this.listByResourceGroupPagingPage(resourceGroupName, 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; } } }); } /** * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. * @param options The options parameters. */ _list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ _listByResourceGroup(resourceGroupName, options) { return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec); } /** * Deletes a Azure Monitor PrivateLinkScope. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. * @param options The options parameters. */ beginDelete(resourceGroupName, scopeName, options) { return __awaiter(this, void 0, void 0, function* () { const directSendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () { return this.client.sendOperationRequest(args, spec); }); const sendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = yield directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON() } }; }); const lro = new LroImpl(sendOperation, { resourceGroupName, scopeName, options }, deleteOperationSpec); return new LroEngine(lro, { resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs }); }); } /** * Deletes a Azure Monitor PrivateLinkScope. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. * @param options The options parameters. */ beginDeleteAndWait(resourceGroupName, scopeName, options) { return __awaiter(this, void 0, void 0, function* () { const poller = yield this.beginDelete(resourceGroupName, scopeName, options); return poller.pollUntilDone(); }); } /** * Returns a Azure Monitor PrivateLinkScope. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. * @param options The options parameters. */ get(resourceGroupName, scopeName, options) { return this.client.sendOperationRequest({ resourceGroupName, scopeName, options }, getOperationSpec); } /** * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value * for InstrumentationKey nor AppId in the Put operation. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update * a Azure Monitor PrivateLinkScope. * @param options The options parameters. */ createOrUpdate(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, options) { return this.client.sendOperationRequest({ resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, options }, createOrUpdateOperationSpec); } /** * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. * @param options The options parameters. */ updateTags(resourceGroupName, scopeName, privateLinkScopeTags, options) { return this.client.sendOperationRequest({ resourceGroupName, scopeName, privateLinkScopeTags, options }, updateTagsOperationSpec); } /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ _listNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec); } /** * ListByResourceGroupNext * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. * @param options The options parameters. */ _listByResourceGroupNext(resourceGroupName, nextLink, options) { return this.client.sendOperationRequest({ resourceGroupName, nextLink, options }, listByResourceGroupNextOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScopeListResult } }, queryParameters: [Parameters.apiVersion10], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], serializer }; const listByResourceGroupOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScopeListResult } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId ], headerParameters: [Parameters.accept], serializer }; const deleteOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", httpMethod: "DELETE", responses: { 200: {}, 201: {}, 202: {}, 204: {} }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.scopeName ], serializer }; const getOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScope } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.scopeName ], headerParameters: [Parameters.accept], serializer }; const createOrUpdateOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScope }, 201: { bodyMapper: Mappers.AzureMonitorPrivateLinkScope } }, requestBody: Parameters.azureMonitorPrivateLinkScopePayload, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.scopeName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const updateTagsOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScope } }, requestBody: Parameters.privateLinkScopeTags, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.scopeName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const listNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScopeListResult } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.nextLink ], headerParameters: [Parameters.accept], serializer }; const listByResourceGroupNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AzureMonitorPrivateLinkScopeListResult } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.nextLink ], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=privateLinkScopes.js.map