infrastructure

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2016 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompileResult

type CompileResult struct{}

CompileResult is the structure containing compilation result values.

type Context

type Context struct {
	context.Shared

	// Action is the sub-action to take when being executed.
	//
	// ActionArgs is the list of arguments for this action.
	//
	// Both of these fields will only be set for the Execute call.
	Action     string
	ActionArgs []string

	// Dir is the directory that the compilation is allowed to write to
	// for persistant storage of data. For other tasks, this will be the
	// directory that was already populated by compilation.
	Dir string

	// The infrastructure configuration itself from the Appfile. This includes
	// the flavor of the infrastructure we want to launch.
	Infra *appfile.Infrastructure
}

Context is the context for operations on infrastructures. Some of the fields in this struct are only available for certain operations.

func (*Context) RouteArgs

func (c *Context) RouteArgs() []string

RouteArgs implements the router.Context interface so we can use Router

func (*Context) RouteName

func (c *Context) RouteName() string

RouteName implements the router.Context interface so we can use Router

func (*Context) UI

func (c *Context) UI() ui.Ui

UI implements router.Context so we can use this in router.Router

type Factory

type Factory func() (Infrastructure, error)

Factory is a factory function for creating infrastructures.

func StructFactory

func StructFactory(v Infrastructure) Factory

StructFactory returns a factory function for creating a newly instantiated copy of the type of v.

type Infrastructure

type Infrastructure interface {
	// Creds is called when Otto determines that it needs credentials
	// for this infrastructure provider. The Infra should query the
	// user (or environment) for creds and return them. Otto will
	// handle encrypting, storing, and retrieving the credentials.
	Creds(*Context) (map[string]string, error)

	// VerifyCreds is called with the result of either prompting or
	// retrieving cached credentials. This gives Infrastructure
	// implementations a chance to check that credentials are good before
	// continuing to perform any operations.
	VerifyCreds(*Context) error

	Execute(*Context) error
	Compile(*Context) (*CompileResult, error)
	Flavors() []string
}

Infrastructure is an interface that must be implemented by each infrastructure type with a method of creating it.

type Mock

type Mock struct {
	CompileCalled  bool
	CompileContext *Context
	CompileResult  *CompileResult
	CompileErr     error
}

Mock is a mock implementation of the Infrastructure interface.

func (*Mock) Compile

func (m *Mock) Compile(ctx *Context) (*CompileResult, error)

func (*Mock) Creds

func (m *Mock) Creds(ctx *Context) (map[string]string, error)

func (*Mock) Execute

func (m *Mock) Execute(ctx *Context) error

func (*Mock) Flavors

func (m *Mock) Flavors() []string

func (*Mock) VerifyCreds

func (m *Mock) VerifyCreds(ctx *Context) error

Jump to

Keyboard shortcuts

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