builder

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package builder defines the types and interfaces that are used to transpile laforge states into other infrastructure and automation tools.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ValidBuilders retains a map of ID to empty Builder objects.
	ValidBuilders = map[string]Builder{
		"tfgcp": tfgcp.New(),

		"null": null.New(),
	}

	// ErrNoBuilderFound is thrown when a builder is not a known valid builder parameter
	ErrNoBuilderFound = errors.New("builder type defined in environment was not recognized")
)

Functions

This section is empty.

Types

type BuildEngine

type BuildEngine struct {
	Base    *core.Laforge
	Builder Builder
}

BuildEngine is the primary interface for building components in gscript.

func New

func New(base *core.Laforge, overwrite, update bool) (*BuildEngine, error)

New attempts to create a new BuildEngine based on the laforge state parameters

func (*BuildEngine) Do

func (b *BuildEngine) Do() error

Do performs the waterfall of functions on the given context with it's designated builder

type Builder

type Builder interface {
	// ID of the builder - usually the go package name
	// - Must be unique and be a valid golang package name.
	ID() string

	// Name of the builder - usually titleized version of the type
	Name() string

	// Human readable description information
	Description() string

	// Author name and contact information
	Author() string

	// Version of the builder implementation
	Version() string

	// Validations returns a list of requirements that need to be met for a builder to be successful
	Validations() validations.Validations

	// Set's a Laforge base instance to work off
	SetLaforge(*core.Laforge) error

	// Check the provided base instance for any dynamic
	// configuration and ensure build requirements are met.
	// While it might seem redundant with Validations(), the point
	// of CheckRequirements is to be able to provide more
	// stateful analysis of the context instead of just true/false fields.
	CheckRequirements() error

	// Gather remote assets, upload to S3, create a unique names, etc.
	PrepareAssets() error

	// Run all the scripts through a rendering step, templating them out
	// if needed.
	GenerateScripts() error

	// Stage any dependencies (or preform pre-rendering tasks)
	StageDependencies() error

	// Attempt to render the actual configuration
	Render() error
}

Builder is a generic interface used to implement various builders.

Directories

Path Synopsis
Package null implements a Laforge Builder module that is effectively a NOOP.
Package null implements a Laforge Builder module that is effectively a NOOP.
Package tfgcp implements a Laforge Builder module for generating terraform configurations that target Google Compute Platform.
Package tfgcp implements a Laforge Builder module for generating terraform configurations that target Google Compute Platform.

Jump to

Keyboard shortcuts

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