UNPKG

@cloud-copilot/iam-collect

Version:

Collect IAM information from AWS Accounts

27 lines 916 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.syncData = syncData; /** * Synchronize the data for a given set of resources. * This will: * 1. Delete any resources that meet the `resourceTypeParts` and are not in the `records` list. * 2. Save all resources that are in the `records`. * * @param records * @param storage * @param accountId * @param resourceTypeParts */ async function syncData(records, storage, accountId, resourceTypeParts) { const allArns = records.map((r) => r.arn); await storage.syncResourceList(accountId, resourceTypeParts, allArns); for (const record of records) { for (const [key, value] of Object.entries(record)) { if (key === 'arn') { continue; } await storage.saveResourceMetadata(accountId, record.arn, key, value); } } } //# sourceMappingURL=sync.js.map