Skip to content

API Reference

Structs

DiagramOptions

Options for diagrams.

Initializer

import { DiagramOptions } from '@aws/pdk/cdk-graph-plugin-diagram'

const diagramOptions: DiagramOptions = { ... }

Properties

Name Type Description
title string No description.
nodePositions {[ key: string ]: INodePosition} No description.
preset aws/pdk/cdk-graph.FilterPreset No description.
theme IGraphThemeConfigAlt | string No description.

titleRequired
public readonly title: string;
  • Type: string

nodePositionsOptional
public readonly nodePositions: {[ key: string ]: INodePosition};

presetOptional
public readonly preset: FilterPreset;
  • Type: aws/pdk/cdk-graph.FilterPreset

themeOptional
public readonly theme: IGraphThemeConfigAlt | string;

IDiagramConfig

Diagram configuration definition.

Initializer

import { IDiagramConfig } from '@aws/pdk/cdk-graph-plugin-diagram'

const iDiagramConfig: IDiagramConfig = { ... }

Properties

Name Type Description
filterPlan aws/pdk/cdk-graph.IGraphFilterPlan Graph {@link IGraphFilterPlanFilter Plan} used to generate a unique diagram.
format DiagramFormat | DiagramFormat[] The output format(s) to generated.
nodePositions {[ key: string ]: INodePosition} Config for predetermined node positions given their CDK construct id.
theme IGraphThemeConfigAlt | string Config for graph theme.
name string Name of the diagram.
title string The title of the diagram.
ignoreDefaults boolean Indicates if default diagram config is applied as defaults to this config.

filterPlanOptional
public readonly filterPlan: IGraphFilterPlan;
  • Type: aws/pdk/cdk-graph.IGraphFilterPlan

Graph {@link IGraphFilterPlanFilter Plan} used to generate a unique diagram.


formatOptional
public readonly format: DiagramFormat | DiagramFormat[];
  • Type: DiagramFormat | DiagramFormat[]
  • Default: DiagramFormat.PNG - which will through extension also generate DiagramFormat.SVG and DiagramFormat.DOT

The output format(s) to generated.


nodePositionsOptional
public readonly nodePositions: {[ key: string ]: INodePosition};

Config for predetermined node positions given their CDK construct id.


themeOptional
public readonly theme: IGraphThemeConfigAlt | string;

Config for graph theme.


nameRequired
public readonly name: string;
  • Type: string

Name of the diagram.

Used as the basename of the generated file(s) which gets the extension appended.


titleRequired
public readonly title: string;
  • Type: string

The title of the diagram.


ignoreDefaultsOptional
public readonly ignoreDefaults: boolean;
  • Type: boolean
  • Default: false

Indicates if default diagram config is applied as defaults to this config.


IDiagramConfigBase

Base config to specific a unique diagram to be generated.

Initializer

import { IDiagramConfigBase } from '@aws/pdk/cdk-graph-plugin-diagram'

const iDiagramConfigBase: IDiagramConfigBase = { ... }

Properties

Name Type Description
filterPlan aws/pdk/cdk-graph.IGraphFilterPlan Graph {@link IGraphFilterPlanFilter Plan} used to generate a unique diagram.
format DiagramFormat | DiagramFormat[] The output format(s) to generated.
nodePositions {[ key: string ]: INodePosition} Config for predetermined node positions given their CDK construct id.
theme IGraphThemeConfigAlt | string Config for graph theme.

filterPlanOptional
public readonly filterPlan: IGraphFilterPlan;
  • Type: aws/pdk/cdk-graph.IGraphFilterPlan

Graph {@link IGraphFilterPlanFilter Plan} used to generate a unique diagram.


formatOptional
public readonly format: DiagramFormat | DiagramFormat[];
  • Type: DiagramFormat | DiagramFormat[]
  • Default: DiagramFormat.PNG - which will through extension also generate DiagramFormat.SVG and DiagramFormat.DOT

The output format(s) to generated.


nodePositionsOptional
public readonly nodePositions: {[ key: string ]: INodePosition};

Config for predetermined node positions given their CDK construct id.


themeOptional
public readonly theme: IGraphThemeConfigAlt | string;

Config for graph theme.


IPluginConfig

Plugin configuration for diagram plugin.

Initializer

import { IPluginConfig } from '@aws/pdk/cdk-graph-plugin-diagram'

const iPluginConfig: IPluginConfig = { ... }

Properties

Name Type Description
defaults IDiagramConfigBase Default configuration to apply to all diagrams.
diagrams IDiagramConfig[] List of diagram configurations to generate diagrams.

defaultsOptional
public readonly defaults: IDiagramConfigBase;

Default configuration to apply to all diagrams.


diagramsOptional
public readonly diagrams: IDiagramConfig[];

List of diagram configurations to generate diagrams.


Classes

CdkGraphDiagramPlugin

  • Implements: aws/pdk/cdk-graph.ICdkGraphPlugin

CdkGraphDiagramPlugin is a {@link ICdkGraphPluginCdkGraph Plugin} implementation for generating diagram artifacts from the {@link CdkGraph} framework.

Initializers

import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram'

new CdkGraphDiagramPlugin(config?: IPluginConfig)
Name Type Description
config IPluginConfig No description.

configOptional

Methods

Name Description
getDiagramArtifact Get diagram artifact for a given name and format.

getDiagramArtifact
public getDiagramArtifact(name: string, format: DiagramFormat): CdkGraphArtifact

Get diagram artifact for a given name and format.

nameRequired
  • Type: string

formatRequired

Static Functions

Name Description
artifactFilename Get standardized artifact file name for diagram artifacts.
artifactId Get standardized artifact id for diagram artifacts.

artifactFilename
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram'

CdkGraphDiagramPlugin.artifactFilename(name: string, format: DiagramFormat)

Get standardized artifact file name for diagram artifacts.

nameRequired
  • Type: string

formatRequired

artifactId
import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram'

CdkGraphDiagramPlugin.artifactId(name: string, format: DiagramFormat)

Get standardized artifact id for diagram artifacts.

nameRequired
  • Type: string

formatRequired

Properties

Name Type Description
config IPluginConfig Get diagram plugin config.
id string Unique identifier for this plugin.
version string Plugin version.
defaultDotArtifact aws/pdk/cdk-graph.CdkGraphArtifact Get default dot artifact.
defaultPngArtifact aws/pdk/cdk-graph.CdkGraphArtifact Get default PNG artifact.
dependencies string[] List of plugins this plugin depends on, including optional semver version (eg: ["foo", "bar@1.2"]).
bind aws/pdk/cdk-graph.IGraphPluginBindCallback Binds the plugin to the CdkGraph instance.
report aws/pdk/cdk-graph.IGraphReportCallback Generate asynchronous reports based on the graph.

configRequired
public readonly config: IPluginConfig;

Get diagram plugin config.


idRequired
public readonly id: string;
  • Type: string

Unique identifier for this plugin.


versionRequired
public readonly version: string;
  • Type: string

Plugin version.


defaultDotArtifactOptional
public readonly defaultDotArtifact: CdkGraphArtifact;
  • Type: aws/pdk/cdk-graph.CdkGraphArtifact

Get default dot artifact.


defaultPngArtifactOptional
public readonly defaultPngArtifact: CdkGraphArtifact;
  • Type: aws/pdk/cdk-graph.CdkGraphArtifact

Get default PNG artifact.


dependenciesOptional
public readonly dependencies: string[];
  • Type: string[]

List of plugins this plugin depends on, including optional semver version (eg: ["foo", "bar@1.2"]).


bindRequired
public readonly bind: IGraphPluginBindCallback;
  • Type: aws/pdk/cdk-graph.IGraphPluginBindCallback

Binds the plugin to the CdkGraph instance.

Enables plugins to receive base configs.


reportOptional
public readonly report: IGraphReportCallback;
  • Type: aws/pdk/cdk-graph.IGraphReportCallback

Generate asynchronous reports based on the graph.

This is not automatically called when synthesizing CDK. Developer must explicitly add await graphInstance.report() to the CDK bin or invoke this outside of the CDK synth. In either case, the plugin receives the in-memory graph interface when invoked, as the CdkGraph will deserialize the graph prior to invoking the plugin report.


Constants

Name Type Description
ARTIFACT_NS string Namespace for artifacts of the diagram plugin.
ID string Fixed id of the diagram plugin.
VERSION string Current semantic version of the diagram plugin.

ARTIFACT_NSRequired
public readonly ARTIFACT_NS: string;
  • Type: string

Namespace for artifacts of the diagram plugin.


IDRequired
public readonly ID: string;
  • Type: string

Fixed id of the diagram plugin.


VERSIONRequired
public readonly VERSION: string;
  • Type: string

Current semantic version of the diagram plugin.


Protocols

IGraphThemeConfigAlt

GraphThemeConfigAlt is simplified definition of theme to apply.

Properties

Name Type Description
rendering IGraphThemeRendering No description.
theme string No description.

renderingOptional
public readonly rendering: IGraphThemeRendering;

themeOptional
public readonly theme: string;
  • Type: string

IGraphThemeRendering

Properties for defining the rendering options for the graph theme.

Properties

Name Type Description
cfnResourceIconMax GraphThemeRenderingIconTarget Highest Graph.CfnResourceNode icon to render.
cfnResourceIconMin GraphThemeRenderingIconTarget Lowest Graph.CfnResourceNode icon to render.
resourceIconMax GraphThemeRenderingIconTarget Highest Graph.ResourceNode icon to render.
resourceIconMin GraphThemeRenderingIconTarget Lowest Graph.ResourceNode icon to render.
layout string Layout direction of the graph.
stack string Specify regex pattern to match root stacks to render.
stage string Specify which stage to render when multiple stages are available.
unconstrainedCrossClusterEdges boolean Prevent cross-cluster edges from ranking nodes in layout.

cfnResourceIconMaxOptional
public readonly cfnResourceIconMax: GraphThemeRenderingIconTarget;

Highest Graph.CfnResourceNode icon to render.


cfnResourceIconMinOptional
public readonly cfnResourceIconMin: GraphThemeRenderingIconTarget;

Lowest Graph.CfnResourceNode icon to render.


resourceIconMaxOptional
public readonly resourceIconMax: GraphThemeRenderingIconTarget;

Highest Graph.ResourceNode icon to render.


resourceIconMinOptional
public readonly resourceIconMin: GraphThemeRenderingIconTarget;

Lowest Graph.ResourceNode icon to render.


layoutOptional
public readonly layout: string;
  • Type: string
  • Default: horizontal

Layout direction of the graph.


stackOptional
public readonly stack: string;
  • Type: string
  • Default: undefined Will render all stacks

Specify regex pattern to match root stacks to render.


stageOptional
public readonly stage: string;
  • Type: string
  • Default: last

Specify which stage to render when multiple stages are available.

Can be a preset value of "first", "last", and "all", or regex string of the stage(s) to render.


unconstrainedCrossClusterEdgesOptional
public readonly unconstrainedCrossClusterEdges: boolean;
  • Type: boolean
  • Default: false

Prevent cross-cluster edges from ranking nodes in layout.

https://graphviz.org/docs/attrs/constraint/


IGraphThemeRenderingIconProps

Icon specific properties for configuring graph rendering of resource icons.

Properties

Name Type Description
cfnResourceIconMax GraphThemeRenderingIconTarget Highest Graph.CfnResourceNode icon to render.
cfnResourceIconMin GraphThemeRenderingIconTarget Lowest Graph.CfnResourceNode icon to render.
resourceIconMax GraphThemeRenderingIconTarget Highest Graph.ResourceNode icon to render.
resourceIconMin GraphThemeRenderingIconTarget Lowest Graph.ResourceNode icon to render.

cfnResourceIconMaxOptional
public readonly cfnResourceIconMax: GraphThemeRenderingIconTarget;

Highest Graph.CfnResourceNode icon to render.


cfnResourceIconMinOptional
public readonly cfnResourceIconMin: GraphThemeRenderingIconTarget;

Lowest Graph.CfnResourceNode icon to render.


resourceIconMaxOptional
public readonly resourceIconMax: GraphThemeRenderingIconTarget;

Highest Graph.ResourceNode icon to render.


resourceIconMinOptional
public readonly resourceIconMin: GraphThemeRenderingIconTarget;

Lowest Graph.ResourceNode icon to render.


IGraphThemeRenderingOptions

Additional graph rendering options.

Properties

Name Type Description
layout string Layout direction of the graph.
stack string Specify regex pattern to match root stacks to render.
stage string Specify which stage to render when multiple stages are available.
unconstrainedCrossClusterEdges boolean Prevent cross-cluster edges from ranking nodes in layout.

layoutOptional
public readonly layout: string;
  • Type: string
  • Default: horizontal

Layout direction of the graph.


stackOptional
public readonly stack: string;
  • Type: string
  • Default: undefined Will render all stacks

Specify regex pattern to match root stacks to render.


stageOptional
public readonly stage: string;
  • Type: string
  • Default: last

Specify which stage to render when multiple stages are available.

Can be a preset value of "first", "last", and "all", or regex string of the stage(s) to render.


unconstrainedCrossClusterEdgesOptional
public readonly unconstrainedCrossClusterEdges: boolean;
  • Type: boolean
  • Default: false

Prevent cross-cluster edges from ranking nodes in layout.

https://graphviz.org/docs/attrs/constraint/


INodePosition

Positional coordinates for a node in inches.

Properties

Name Type Description
x number No description.
y number No description.

xRequired
public readonly x: number;
  • Type: number

yRequired
public readonly y: number;
  • Type: number

Enums

DiagramFormat

Supported diagram formats that can be generated.

Extended formats are automatically generated, for example if you generate "png" which extends "svg" which extends "dot", the resulting generated files will be all aforementioned.

Members

Name Description
DOT Graphviz DOT Language.
SVG SVG generated using dot-wasm from {@link DiagramFormat.DOT} file.
PNG PNG generated using sharp from {@link DiagramFormat.SVG} file.

DOT

Graphviz DOT Language.


SVG

SVG generated using dot-wasm from {@link DiagramFormat.DOT} file.


PNG

PNG generated using sharp from {@link DiagramFormat.SVG} file.


GraphThemeRenderingIconTarget

Icon rendering target options for GraphTheme.

Members

Name Description
DATA Data icon (eg: EC2 instance type icon, T2).
RESOURCE Resource icon.
GENERAL General icon.
SERVICE Service icon.
CATEGORY Category icon.

DATA

Data icon (eg: EC2 instance type icon, T2).

Resolution precedence: data => resource => general => service => category


RESOURCE

Resource icon.

Resolution precedence: resource => general => service => category


GENERAL

General icon.

Resolution precedence: resource => general => service => category


SERVICE

Service icon.

Resolution precedence: service => category


CATEGORY

Category icon.

Resolution precedence: category



Last update: 2024-11-17