UNPKG

@infrascan/aws-s3-scanner

Version:

Infrascan scanner definition for AWS S3

104 lines (102 loc) 2.67 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/graph.ts var graph_exports = {}; __export(graph_exports, { S3Entity: () => S3Entity }); module.exports = __toCommonJS(graph_exports); var import_core = require("@infrascan/core"); var S3Entity = { version: "0.1.1", debugLabel: "s3-bucket", provider: "aws", command: "ListBuckets", category: "s3", subcategory: "bucket", nodeType: "s3-bucket", selector: "S3|ListBuckets|[]", getState(state, context) { return (0, import_core.evaluateSelector)( context.account, context.region, S3Entity.selector, state ); }, translate(val) { return (val._result.Buckets ?? []).map((bucket) => ({ ...bucket, $metadata: val._metadata, $parameters: val._parameters })); }, components: { $metadata(val) { return { version: S3Entity.version, timestamp: val.$metadata.timestamp }; }, $graph(val) { return { id: `arn:aws:s3:::${val.Name}`, label: val.Name, nodeClass: "visual", nodeType: S3Entity.nodeType, parent: val.$metadata.account }; }, $source(val) { return { command: S3Entity.command, parameters: val.$parameters }; }, tenant(val) { return { tenantId: val.$metadata.account, provider: S3Entity.provider, partition: val.$metadata.partition }; }, location(val) { return { code: val.$metadata.region }; }, resource(val) { return { id: `arn:aws:s3:::${val.Name}`, name: val.Name, category: S3Entity.category, subcategory: S3Entity.subcategory }; }, audit(val) { return { createdAt: val.CreationDate }; } } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { S3Entity });