@cloud-copilot/iam-collect
Version:
Collect IAM information from AWS Accounts
34 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIndexersForService = getIndexersForService;
const services_js_1 = require("../services.js");
const accountOrgs_js_1 = require("./indexers/accountOrgs.js");
const apigateways_js_1 = require("./indexers/apigateways.js");
const buckets_js_1 = require("./indexers/buckets.js");
const iamPrincipalsToTrustPolicies_js_1 = require("./indexers/iamPrincipalsToTrustPolicies.js");
const vpcEndpoints_js_1 = require("./indexers/vpcEndpoints.js");
const allIndexers = [
accountOrgs_js_1.AccountOrganizationIndexer,
apigateways_js_1.ApiGatewayIndexer,
iamPrincipalsToTrustPolicies_js_1.IamPrincipalsToTrustPoliciesIndexer,
buckets_js_1.S3BucketIndexer,
vpcEndpoints_js_1.VpcEndpointIndexer
];
const indexMap = new Map();
for (const indexer of allIndexers) {
const service = (0, services_js_1.lowerCaseService)(indexer.awsService);
if (!indexMap.has(service)) {
indexMap.set(service, []);
}
indexMap.get(service).push(indexer);
}
/**
* Get the indexers for a given AWS service.
*
* @param awsService the AWS service to get the indexers for
* @returns An array of indexers that are for the specified service.
*/
function getIndexersForService(awsService) {
return indexMap.get((0, services_js_1.lowerCaseService)(awsService)) ?? [];
}
//# sourceMappingURL=indexMap.js.map