UNPKG

@cloud-copilot/iam-collect

Version:

Collect IAM information from AWS Accounts

62 lines 2.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KafkaClustersSync = void 0; const client_kafka_1 = require("@aws-sdk/client-kafka"); 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.KafkaClustersSync = (0, typedSync_js_1.createTypedSyncOperation)('kafka', 'clusters', (0, typedSync_js_1.createResourceSyncType)({ client: client_kafka_1.KafkaClient, command: client_kafka_1.ListClustersV2Command, key: 'ClusterInfoList', paginationConfig: { inputKey: 'NextToken', outputKey: 'NextToken' }, arn: (cluster) => cluster.ClusterArn, resourceTypeParts: (accountId, region) => ({ service: 'kafka', resourceType: 'cluster', account: accountId, region: region }), extraFields: { details: async (client, cluster) => { return (0, client_tools_js_1.runAndCatch404)(async () => { if (cluster.ClusterType !== 'PROVISIONED') { return undefined; } const result = await client.send(new client_kafka_1.DescribeClusterCommand({ ClusterArn: cluster.ClusterArn })); return result.ClusterInfo; }); }, policy: async (client, cluster) => { return (0, client_tools_js_1.runAndCatch404)(async () => { const result = await client.send(new client_kafka_1.GetClusterPolicyCommand({ ClusterArn: cluster.ClusterArn })); return (0, json_js_1.parseIfPresent)(result.Policy); }); }, tags: async (client, cluster) => { return (0, client_tools_js_1.runAndCatch404)(async () => { const result = await client.send(new client_kafka_1.ListTagsForResourceCommand({ ResourceArn: cluster.ClusterArn })); return result.Tags; }); } }, tags: (cluster) => cluster.extraFields.tags, results: (cluster) => ({ metadata: { name: cluster.ClusterName, arn: cluster.ClusterArn, keyId: cluster.extraFields.details?.EncryptionInfo?.EncryptionAtRest?.DataVolumeKMSKeyId }, policy: cluster.extraFields.policy }) })); //# sourceMappingURL=clusters.js.map