@azure/arm-monitor
Version:
A generated SDK for MonitorClient.
361 lines • 14.1 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 DataCollectionEndpoints operations. */
export class DataCollectionEndpointsImpl {
/**
* Initialize a new instance of the class DataCollectionEndpoints class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Lists all data collection endpoints in the specified 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_1, _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_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 all data collection endpoints in the specified subscription
* @param options The options parameters.
*/
listBySubscription(options) {
const iter = this.listBySubscriptionPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listBySubscriptionPagingPage(options);
}
};
}
listBySubscriptionPagingPage(options) {
return __asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
let result = yield __await(this._listBySubscription(options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listBySubscriptionNext(continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listBySubscriptionPagingAll(options) {
return __asyncGenerator(this, arguments, function* listBySubscriptionPagingAll_1() {
var e_2, _a;
try {
for (var _b = __asyncValues(this.listBySubscriptionPagingPage(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 all data collection endpoints in the specified 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);
}
/**
* Lists all data collection endpoints in the specified subscription
* @param options The options parameters.
*/
_listBySubscription(options) {
return this.client.sendOperationRequest({ options }, listBySubscriptionOperationSpec);
}
/**
* Returns the specified data collection endpoint.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param dataCollectionEndpointName The name of the data collection endpoint. The name is case
* insensitive.
* @param options The options parameters.
*/
get(resourceGroupName, dataCollectionEndpointName, options) {
return this.client.sendOperationRequest({ resourceGroupName, dataCollectionEndpointName, options }, getOperationSpec);
}
/**
* Creates or updates a data collection endpoint.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param dataCollectionEndpointName The name of the data collection endpoint. The name is case
* insensitive.
* @param options The options parameters.
*/
create(resourceGroupName, dataCollectionEndpointName, options) {
return this.client.sendOperationRequest({ resourceGroupName, dataCollectionEndpointName, options }, createOperationSpec);
}
/**
* Updates part of a data collection endpoint.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param dataCollectionEndpointName The name of the data collection endpoint. The name is case
* insensitive.
* @param options The options parameters.
*/
update(resourceGroupName, dataCollectionEndpointName, options) {
return this.client.sendOperationRequest({ resourceGroupName, dataCollectionEndpointName, options }, updateOperationSpec);
}
/**
* Deletes a data collection endpoint.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param dataCollectionEndpointName The name of the data collection endpoint. The name is case
* insensitive.
* @param options The options parameters.
*/
delete(resourceGroupName, dataCollectionEndpointName, options) {
return this.client.sendOperationRequest({ resourceGroupName, dataCollectionEndpointName, options }, deleteOperationSpec);
}
/**
* 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);
}
/**
* ListBySubscriptionNext
* @param nextLink The nextLink from the previous successful call to the ListBySubscription method.
* @param options The options parameters.
*/
_listBySubscriptionNext(nextLink, options) {
return this.client.sendOperationRequest({ nextLink, options }, listBySubscriptionNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByResourceGroupOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResourceListResult
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listBySubscriptionOperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResourceListResult
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
queryParameters: [Parameters.apiVersion12],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResource
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.dataCollectionEndpointName
],
headerParameters: [Parameters.accept],
serializer
};
const createOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResource
},
201: {
bodyMapper: Mappers.DataCollectionEndpointResource
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
requestBody: Parameters.body,
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.dataCollectionEndpointName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const updateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResource
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
requestBody: Parameters.body1,
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.dataCollectionEndpointName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.dataCollectionEndpointName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResourceListResult
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listBySubscriptionNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DataCollectionEndpointResourceListResult
},
default: {
bodyMapper: Mappers.ErrorResponseCommonV2
}
},
queryParameters: [Parameters.apiVersion12],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=dataCollectionEndpoints.js.map