cloud-report
Version:
Collects and analyzes cloud resources
31 lines (30 loc) • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../utils");
const aws_1 = require("../../../utils/aws");
const base_1 = require("../../base");
const field_level_encryption_1 = require("./field_level_encryption");
class FieldLevelEncryptionconfigsCollector extends base_1.BaseCollector {
collect() {
return this.listAllFieldLevelEncryptionconfigs();
}
async listAllFieldLevelEncryptionconfigs() {
try {
const cloudfront = this.getClient("CloudFront", "us-east-1");
const field_level_encrypt_Collector = new field_level_encryption_1.FieldLevelEncryptionCollector();
field_level_encrypt_Collector.setSession(this.getSession());
const field_level_encrypt_Data = await utils_1.CollectorUtil.cachedCollect(field_level_encrypt_Collector);
const field_level_encrypt_configs = {};
for (const field_level_encrypt of field_level_encrypt_Data.field_level_encrypt) {
const cloudfrontFieldLevelEncryptionData = await cloudfront.getFieldLevelEncryptionConfig({ Id: field_level_encrypt.Id }).promise();
field_level_encrypt_configs[field_level_encrypt.Id] = cloudfrontFieldLevelEncryptionData.FieldLevelEncryptionConfig;
await utils_1.CommonUtil.wait(200);
}
return { field_level_encrypt_configs };
}
catch (error) {
aws_1.AWSErrorHandler.handle(error);
}
}
}
exports.FieldLevelEncryptionconfigsCollector = FieldLevelEncryptionconfigsCollector;