override

package
v1.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package override defines functionality to interact with the "overrides/" directory for accessing and mutating the Copilot generated AWS CloudFormation templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScaffoldWithCDK

func ScaffoldWithCDK(fs afero.Fs, dir string, seeds []template.CFNResource) error

ScaffoldWithCDK bootstraps a CDK application under dir/ to override the seed CloudFormation resources.

Types

type CDK

type CDK struct {
	// contains filtered or unexported fields
}

CDK is an Overrider that can transform a CloudFormation template with the Cloud Development Kit.

func WithCDK

func WithCDK(root string, opts CDKOpts) *CDK

WithCDK instantiates a new CDK Overrider with root being the path to the overrides/ directory.

func (*CDK) Override

func (cdk *CDK) Override(body []byte) ([]byte, error)

Override returns the extended CloudFormation template body using the CDK. In order to ensure the CDK transformations can be applied, Copilot first installs any CDK dependencies as well as the toolkit itself.

type CDKOpts

type CDKOpts struct {
	ExecWriter io.Writer                                   // Writer to forward stdout and stderr writes from os/exec calls. If nil default to io.Discard.
	FS         afero.Fs                                    // File system interface. If nil, defaults to the OS file system.
	EnvVars    map[string]string                           // Environment variables key value pairs to pass to the "cdk synth" command.
	LookPathFn func(executable string) (string, error)     // Search for the executable under $PATH. Defaults to exec.LookPath.
	CommandFn  func(name string, args ...string) *exec.Cmd // Create a new executable command. Defaults to exec.Command rooted at the overrides/ dir.
}

CDKOpts is optional configuration for initializing a CDK Overrider.

type ErrNotExist

type ErrNotExist struct {
	// contains filtered or unexported fields
}

ErrNotExist occurs when the path of the file associated with an Overrider does not exist.

func (*ErrNotExist) Error

func (err *ErrNotExist) Error() string

type Info

type Info struct {
	// contains filtered or unexported fields
}

Info holds metadata about an overrider.

func Lookup

func Lookup(path string, fs afero.Fs) (Info, error)

Lookup returns information indicating if the overrider is a CDK application or YAML Patch document. If path does not exist or is an empty directory, then return an ErrNotExist. If path is a YAML patch document, then IsYAMLPatch evaluates to true. If path is a directory that contains a cdk.json file, then IsCDK evaluates to true.

func (Info) IsCDK

func (i Info) IsCDK() bool

IsCDK returns true if the overrider is a CDK application.

func (Info) IsYAMLPatch

func (i Info) IsYAMLPatch() bool

IsYAMLPatch returns true if the overrider is a YAML patch document.

func (Info) Path

func (i Info) Path() string

Path returns the path to the overrider. For CDK applications, returns the root of the CDK directory. For YAML patch documents, returns the path to the file.

type Noop

type Noop struct{}

Noop represents an Overrider that does not do any transformations.

func (*Noop) Override

func (no *Noop) Override(body []byte) ([]byte, error)

Override does nothing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL