cloud-report
Version:
Collects and analyzes cloud resources
31 lines (30 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../utils");
const aws_1 = require("../../../utils/aws");
const base_1 = require("../../base");
class HostedZonesCollector extends base_1.BaseCollector {
collect(callback) {
return this.listAllHostedZones();
}
async listAllHostedZones() {
try {
const route53 = this.getClient("Route53", "us-east-1");
let fetchPending = true;
let marker;
let hosted_zones = [];
while (fetchPending) {
const route53HostedZonesData = await route53.listHostedZones({ Marker: marker }).promise();
hosted_zones = hosted_zones.concat(route53HostedZonesData.HostedZones);
marker = route53HostedZonesData.NextMarker;
fetchPending = marker !== undefined;
await utils_1.CommonUtil.wait(200);
}
return { hosted_zones };
}
catch (error) {
aws_1.AWSErrorHandler.handle(error);
}
}
}
exports.HostedZonesCollector = HostedZonesCollector;