UNPKG

@azure/arm-monitor

Version:
128 lines 5.03 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 AlertRuleIncidents operations. */ export class AlertRuleIncidentsImpl { /** * Initialize a new instance of the class AlertRuleIncidents class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Gets a list of incidents associated to an alert rule * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ruleName The name of the rule. * @param options The options parameters. */ listByAlertRule(resourceGroupName, ruleName, options) { const iter = this.listByAlertRulePagingAll(resourceGroupName, ruleName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listByAlertRulePagingPage(resourceGroupName, ruleName, options); } }; } listByAlertRulePagingPage(resourceGroupName, ruleName, options) { return __asyncGenerator(this, arguments, function* listByAlertRulePagingPage_1() { let result = yield __await(this._listByAlertRule(resourceGroupName, ruleName, options)); yield yield __await(result.value || []); }); } listByAlertRulePagingAll(resourceGroupName, ruleName, options) { return __asyncGenerator(this, arguments, function* listByAlertRulePagingAll_1() { var e_1, _a; try { for (var _b = __asyncValues(this.listByAlertRulePagingPage(resourceGroupName, ruleName, 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 an incident associated to an alert rule * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ruleName The name of the rule. * @param incidentName The name of the incident to retrieve. * @param options The options parameters. */ get(resourceGroupName, ruleName, incidentName, options) { return this.client.sendOperationRequest({ resourceGroupName, ruleName, incidentName, options }, getOperationSpec); } /** * Gets a list of incidents associated to an alert rule * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param ruleName The name of the rule. * @param options The options parameters. */ _listByAlertRule(resourceGroupName, ruleName, options) { return this.client.sendOperationRequest({ resourceGroupName, ruleName, options }, listByAlertRuleOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const getOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Incident }, default: { bodyMapper: Mappers.ErrorResponse } }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.ruleName, Parameters.incidentName ], headerParameters: [Parameters.accept], serializer }; const listByAlertRuleOperationSpec = { path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.IncidentListResult } }, queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, Parameters.subscriptionId, Parameters.ruleName ], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=alertRuleIncidents.js.map