UNPKG

@cloud-copilot/iam-collect

Version:

Collect IAM information from AWS Accounts

24 lines 817 B
/** * 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 */ export 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