@azure/arm-monitor
Version:
A generated SDK for MonitorClient.
295 lines • 11.3 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 ActivityLogAlerts operations. */
export class ActivityLogAlertsImpl {
/**
* Initialize a new instance of the class ActivityLogAlerts class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Get a list of all activity log alerts in a subscription.
* @param options The options parameters.
*/
listBySubscriptionId(options) {
const iter = this.listBySubscriptionIdPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listBySubscriptionIdPagingPage(options);
}
};
}
listBySubscriptionIdPagingPage(options) {
return __asyncGenerator(this, arguments, function* listBySubscriptionIdPagingPage_1() {
let result = yield __await(this._listBySubscriptionId(options));
yield yield __await(result.value || []);
});
}
listBySubscriptionIdPagingAll(options) {
return __asyncGenerator(this, arguments, function* listBySubscriptionIdPagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listBySubscriptionIdPagingPage(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; }
}
});
}
/**
* Get a list of all activity log alerts in 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 || []);
});
}
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; }
}
});
}
/**
* Create a new activity log alert or update an existing one.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param activityLogAlertName The name of the activity log alert.
* @param activityLogAlert The activity log alert to create or use for the update.
* @param options The options parameters.
*/
createOrUpdate(resourceGroupName, activityLogAlertName, activityLogAlert, options) {
return this.client.sendOperationRequest({ resourceGroupName, activityLogAlertName, activityLogAlert, options }, createOrUpdateOperationSpec);
}
/**
* Get an activity log alert.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param activityLogAlertName The name of the activity log alert.
* @param options The options parameters.
*/
get(resourceGroupName, activityLogAlertName, options) {
return this.client.sendOperationRequest({ resourceGroupName, activityLogAlertName, options }, getOperationSpec);
}
/**
* Delete an activity log alert.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param activityLogAlertName The name of the activity log alert.
* @param options The options parameters.
*/
delete(resourceGroupName, activityLogAlertName, options) {
return this.client.sendOperationRequest({ resourceGroupName, activityLogAlertName, options }, deleteOperationSpec);
}
/**
* Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate
* method.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param activityLogAlertName The name of the activity log alert.
* @param activityLogAlertPatch Parameters supplied to the operation.
* @param options The options parameters.
*/
update(resourceGroupName, activityLogAlertName, activityLogAlertPatch, options) {
return this.client.sendOperationRequest({
resourceGroupName,
activityLogAlertName,
activityLogAlertPatch,
options
}, updateOperationSpec);
}
/**
* Get a list of all activity log alerts in a subscription.
* @param options The options parameters.
*/
_listBySubscriptionId(options) {
return this.client.sendOperationRequest({ options }, listBySubscriptionIdOperationSpec);
}
/**
* Get a list of all activity log alerts in 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);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const createOrUpdateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.ActivityLogAlertResource
},
201: {
bodyMapper: Mappers.ActivityLogAlertResource
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.activityLogAlert,
queryParameters: [Parameters.apiVersion11],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.activityLogAlertName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ActivityLogAlertResource
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion11],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.activityLogAlertName
],
headerParameters: [Parameters.accept],
serializer
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion11],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.activityLogAlertName
],
headerParameters: [Parameters.accept],
serializer
};
const updateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.ActivityLogAlertResource
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.activityLogAlertPatch,
queryParameters: [Parameters.apiVersion11],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId,
Parameters.activityLogAlertName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const listBySubscriptionIdOperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ActivityLogAlertList
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion11],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ActivityLogAlertList
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
queryParameters: [Parameters.apiVersion11],
urlParameters: [
Parameters.$host,
Parameters.resourceGroupName,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=activityLogAlerts.js.map