UNPKG

@infrascan/aws-cloudfront-scanner

Version:

Infrascan scanner definition for AWS Cloudfront

111 lines (109 loc) 3.22 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, { CloudfrontDistributionEntity: () => CloudfrontDistributionEntity }); module.exports = __toCommonJS(graph_exports); var import_core = require("@infrascan/core"); var CloudfrontDistributionEntity = { version: "0.1.0", debugLabel: "cloudfront", provider: "aws", command: "ListDistributions", category: "cloudfront", subcategory: "distribution", nodeType: "cloudfront-distribution", selector: "CloudFront|ListDistributions|[]", getState(state, context) { return (0, import_core.evaluateSelector)( context.account, context.region, CloudfrontDistributionEntity.selector, state ); }, translate(val) { return (val._result.DistributionList?.Items ?? []).map( (distribution) => Object.assign(distribution, { $metadata: val._metadata, $parameters: val._parameters }) ); }, components: { $metadata(val) { return { version: CloudfrontDistributionEntity.version, timestamp: val.$metadata.timestamp }; }, $graph(val) { return { id: val.ARN, label: val.DomainName, nodeType: CloudfrontDistributionEntity.nodeType, parent: val.$metadata.account }; }, $source(val) { return { command: CloudfrontDistributionEntity.command, parameters: val.$parameters }; }, dns(val) { const domains = [val.DomainName]; if (val.Aliases?.Items == null) { return { domains }; } return { domains: domains.concat(val.Aliases.Items) }; }, tenant(val) { return { tenantId: val.$metadata.account, provider: CloudfrontDistributionEntity.provider, partition: val.$metadata.partition }; }, resource(val) { return { id: val.ARN, name: val.DomainName, category: CloudfrontDistributionEntity.category, subcategory: CloudfrontDistributionEntity.subcategory, description: val.Comment }; }, distribution(val) { return { originGroups: val.OriginGroups?.Items, cacheBehaviours: val.CacheBehaviors?.Items, defaultCacheBehaviour: val.DefaultCacheBehavior }; } } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { CloudfrontDistributionEntity });