@cloud-copilot/iam-collect
Version:
Collect IAM information from AWS Accounts
31 lines • 1.15 kB
JavaScript
import { lowerCaseService } from '../services.js';
import { AccountOrganizationIndexer } from './indexers/accountOrgs.js';
import { ApiGatewayIndexer } from './indexers/apigateways.js';
import { S3BucketIndexer } from './indexers/buckets.js';
import { IamPrincipalsToTrustPoliciesIndexer } from './indexers/iamPrincipalsToTrustPolicies.js';
import { VpcEndpointIndexer } from './indexers/vpcEndpoints.js';
const allIndexers = [
AccountOrganizationIndexer,
ApiGatewayIndexer,
IamPrincipalsToTrustPoliciesIndexer,
S3BucketIndexer,
VpcEndpointIndexer
];
const indexMap = new Map();
for (const indexer of allIndexers) {
const service = 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.
*/
export function getIndexersForService(awsService) {
return indexMap.get(lowerCaseService(awsService)) ?? [];
}
//# sourceMappingURL=indexMap.js.map