@cloud-copilot/iam-collect
Version:
Collect IAM information from AWS Accounts
48 lines • 2.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.S3TableBucketsSync = void 0;
const client_s3tables_1 = require("@aws-sdk/client-s3tables");
const client_tools_js_1 = require("../../utils/client-tools.js");
const json_js_1 = require("../../utils/json.js");
const typedSync_js_1 = require("../typedSync.js");
exports.S3TableBucketsSync = (0, typedSync_js_1.createTypedSyncOperation)('s3tables', 'tableBuckets', (0, typedSync_js_1.createResourceSyncType)({
client: client_s3tables_1.S3TablesClient,
command: client_s3tables_1.ListTableBucketsCommand,
key: 'tableBuckets',
paginationConfig: {
inputKey: 'continuationToken',
outputKey: 'continuationToken'
},
arn: (bucket) => bucket.arn,
extraFields: {
policy: async (client, bucket) => {
return (0, client_tools_js_1.runAndCatch404)(async () => {
const policy = await client.send(new client_s3tables_1.GetTableBucketPolicyCommand({ tableBucketARN: bucket.arn }));
return (0, json_js_1.parseIfPresent)(policy.resourcePolicy);
});
},
encryption: async (client, bucket) => {
return (0, client_tools_js_1.runAndCatch404)(async () => {
const encryption = await client.send(new client_s3tables_1.GetTableBucketEncryptionCommand({ tableBucketARN: bucket.arn }));
return encryption.encryptionConfiguration;
});
}
},
tags: (bucket) => undefined,
resourceTypeParts: (account, region) => ({
service: 's3tables',
resourceType: 'bucket',
account,
region
}),
results: (bucket) => ({
metadata: {
name: bucket.name,
id: bucket.tableBucketId,
encryptionAlgorithm: bucket.extraFields.encryption?.sseAlgorithm,
key: bucket.extraFields.encryption?.kmsKeyArn
},
policy: bucket.extraFields.policy
})
}));
//# sourceMappingURL=s3TablesSync.js.map