@azure/arm-monitor
Version:
A generated SDK for MonitorClient.
92 lines • 3.35 kB
JavaScript
/*
* 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 MetricDefinitions operations. */
export class MetricDefinitionsImpl {
/**
* Initialize a new instance of the class MetricDefinitions class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Lists the metric definitions for the resource.
* @param resourceUri The identifier of the resource.
* @param options The options parameters.
*/
list(resourceUri, options) {
const iter = this.listPagingAll(resourceUri, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(resourceUri, options);
}
};
}
listPagingPage(resourceUri, options) {
return __asyncGenerator(this, arguments, function* listPagingPage_1() {
let result = yield __await(this._list(resourceUri, options));
yield yield __await(result.value || []);
});
}
listPagingAll(resourceUri, options) {
return __asyncGenerator(this, arguments, function* listPagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listPagingPage(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 the metric definitions for the resource.
* @param resourceUri The identifier of the resource.
* @param options The options parameters.
*/
_list(resourceUri, options) {
return this.client.sendOperationRequest({ resourceUri, options }, listOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec = {
path: "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.MetricDefinitionCollection
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion4, Parameters.metricnamespace],
urlParameters: [Parameters.$host, Parameters.resourceUri],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=metricDefinitions.js.map