@infrascan/fs-connector
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

@infrascan/fs-connector

Infrascan connectors act as the plumbing between the Infrascan SDK and wherever you persist your scan state.

The Fs connector uses the local filesystem. This library exposes a single builder function which takes a base path to use as the directory.

All state files are written into the directory in the format: <account>-<region>-<service>-<function>.json.

Quickstart

import Infrascan from "@infrascan/sdk";
import buildFsConnector from "@infrascan/fs-connector";
import { registerAwsScanners } from "@infrascan/aws";
import { fromIni } from "@aws-sdk/credential-providers";

const credentials = fromIni({ profile: "dev" });
const regions = ["us-east-1","us-west-1"];
const services = ["SNS","Lambda","S3"];

const connector = buildFsConnector('state');
const infrascan = registerAwsScanners(new Infrascan());

infrascan.performScan(
  credentials,
  connector
).then(function (scanMetadata) {
  console.log("Scan Complete!", scanMetadata);
  return infrascan.generateGraph(
    scanMetadata,
    connector
  );
}).then(function (graphData) {
  console.log("Graph generated!", graphData);
}).catch(function (err) {
  console.error("Failed to scan", err);
});

Package Sidebar

Install

npm i @infrascan/fs-connector

Weekly Downloads

1

Version

0.2.3

License

MPL-2.0

Unpacked Size

27.7 kB

Total Files

7

Last publish

Collaborators

  • lfarrelly