@azure/arm-security
Version:
A generated SDK for SecurityCenter.
338 lines • 13.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 CustomAssessmentAutomations operations. */
export class CustomAssessmentAutomationsImpl {
/**
* Initialize a new instance of the class CustomAssessmentAutomations class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* List custom assessment automations by provided subscription and resource group
* @param resourceGroupName The name of the resource group within the user's subscription. 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; }
}
});
}
/**
* List custom assessment automations by provided 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; }
}
});
}
/**
* Gets a single custom assessment automation by name for the provided subscription and resource group.
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param customAssessmentAutomationName Name of the Custom Assessment Automation.
* @param options The options parameters.
*/
get(resourceGroupName, customAssessmentAutomationName, options) {
return this.client.sendOperationRequest({ resourceGroupName, customAssessmentAutomationName, options }, getOperationSpec);
}
/**
* Creates or updates a custom assessment automation for the provided subscription. Please note that
* providing an existing custom assessment automation will replace the existing record.
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param customAssessmentAutomationName Name of the Custom Assessment Automation.
* @param customAssessmentAutomationBody Custom Assessment Automation body
* @param options The options parameters.
*/
create(resourceGroupName, customAssessmentAutomationName, customAssessmentAutomationBody, options) {
return this.client.sendOperationRequest({
resourceGroupName,
customAssessmentAutomationName,
customAssessmentAutomationBody,
options
}, createOperationSpec);
}
/**
* Deletes a custom assessment automation by name for a provided subscription
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param customAssessmentAutomationName Name of the Custom Assessment Automation.
* @param options The options parameters.
*/
delete(resourceGroupName, customAssessmentAutomationName, options) {
return this.client.sendOperationRequest({ resourceGroupName, customAssessmentAutomationName, options }, deleteOperationSpec);
}
/**
* List custom assessment automations by provided subscription and resource group
* @param resourceGroupName The name of the resource group within the user's subscription. The name is
* case insensitive.
* @param options The options parameters.
*/
_listByResourceGroup(resourceGroupName, options) {
return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec);
}
/**
* List custom assessment automations by provided subscription
* @param options The options parameters.
*/
_listBySubscription(options) {
return this.client.sendOperationRequest({ options }, listBySubscriptionOperationSpec);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName The name of the resource group within the user's subscription. 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 getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.CustomAssessmentAutomation
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.customAssessmentAutomationName
],
headerParameters: [Parameters.accept],
serializer
};
const createOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.CustomAssessmentAutomation
},
201: {
bodyMapper: Mappers.CustomAssessmentAutomation
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.customAssessmentAutomationBody,
queryParameters: [Parameters.apiVersion1],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.customAssessmentAutomationName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.customAssessmentAutomationName
],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.CustomAssessmentAutomationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listBySubscriptionOperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.CustomAssessmentAutomationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listByResourceGroupNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.CustomAssessmentAutomationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
const listBySubscriptionNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.CustomAssessmentAutomationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.nextLink
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=customAssessmentAutomations.js.map