@azure/arm-security
Version:
A generated SDK for SecurityCenter.
278 lines • 11 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 SubAssessments operations. */
export class SubAssessmentsImpl {
/**
* Initialize a new instance of the class SubAssessments class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* Get security sub-assessments on all your scanned resources inside a subscription scope
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param options The options parameters.
*/
listAll(scope, options) {
const iter = this.listAllPagingAll(scope, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listAllPagingPage(scope, options);
}
};
}
listAllPagingPage(scope, options) {
return __asyncGenerator(this, arguments, function* listAllPagingPage_1() {
let result = yield __await(this._listAll(scope, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listAllNext(scope, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listAllPagingAll(scope, options) {
return __asyncGenerator(this, arguments, function* listAllPagingAll_1() {
var e_1, _a;
try {
for (var _b = __asyncValues(this.listAllPagingPage(scope, 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 security sub-assessments on all your scanned resources inside a scope
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param assessmentName The Assessment Key - Unique key for the assessment type
* @param options The options parameters.
*/
list(scope, assessmentName, options) {
const iter = this.listPagingAll(scope, assessmentName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(scope, assessmentName, options);
}
};
}
listPagingPage(scope, assessmentName, options) {
return __asyncGenerator(this, arguments, function* listPagingPage_1() {
let result = yield __await(this._list(scope, assessmentName, options));
yield yield __await(result.value || []);
let continuationToken = result.nextLink;
while (continuationToken) {
result = yield __await(this._listNext(scope, assessmentName, continuationToken, options));
continuationToken = result.nextLink;
yield yield __await(result.value || []);
}
});
}
listPagingAll(scope, assessmentName, options) {
return __asyncGenerator(this, arguments, function* listPagingAll_1() {
var e_2, _a;
try {
for (var _b = __asyncValues(this.listPagingPage(scope, assessmentName, 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; }
}
});
}
/**
* Get security sub-assessments on all your scanned resources inside a subscription scope
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param options The options parameters.
*/
_listAll(scope, options) {
return this.client.sendOperationRequest({ scope, options }, listAllOperationSpec);
}
/**
* Get security sub-assessments on all your scanned resources inside a scope
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param assessmentName The Assessment Key - Unique key for the assessment type
* @param options The options parameters.
*/
_list(scope, assessmentName, options) {
return this.client.sendOperationRequest({ scope, assessmentName, options }, listOperationSpec);
}
/**
* Get a security sub-assessment on your scanned resource
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param assessmentName The Assessment Key - Unique key for the assessment type
* @param subAssessmentName The Sub-Assessment Key - Unique key for the sub-assessment type
* @param options The options parameters.
*/
get(scope, assessmentName, subAssessmentName, options) {
return this.client.sendOperationRequest({ scope, assessmentName, subAssessmentName, options }, getOperationSpec);
}
/**
* ListAllNext
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param nextLink The nextLink from the previous successful call to the ListAll method.
* @param options The options parameters.
*/
_listAllNext(scope, nextLink, options) {
return this.client.sendOperationRequest({ scope, nextLink, options }, listAllNextOperationSpec);
}
/**
* ListNext
* @param scope Scope of the query, can be subscription
* (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group
* (/providers/Microsoft.Management/managementGroups/mgName).
* @param assessmentName The Assessment Key - Unique key for the assessment type
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
_listNext(scope, assessmentName, nextLink, options) {
return this.client.sendOperationRequest({ scope, assessmentName, nextLink, options }, listNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listAllOperationSpec = {
path: "/{scope}/providers/Microsoft.Security/subAssessments",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SecuritySubAssessmentList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion8],
urlParameters: [Parameters.$host, Parameters.scope],
headerParameters: [Parameters.accept],
serializer
};
const listOperationSpec = {
path: "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SecuritySubAssessmentList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion8],
urlParameters: [
Parameters.$host,
Parameters.scope,
Parameters.assessmentName
],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec = {
path: "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SecuritySubAssessment
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion8],
urlParameters: [
Parameters.$host,
Parameters.scope,
Parameters.assessmentName,
Parameters.subAssessmentName
],
headerParameters: [Parameters.accept],
serializer
};
const listAllNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SecuritySubAssessmentList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion8],
urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SecuritySubAssessmentList
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion8],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.scope,
Parameters.assessmentName
],
headerParameters: [Parameters.accept],
serializer
};
//# sourceMappingURL=subAssessments.js.map