cloudz

package
v0.0.0-...-d772457 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudAddExpGetAtt

func CloudAddExpGetAtt(tpl *gocf.Template, p Plugin, ref CloudRef, att CloudAtt)

CloudAddExpGetAtt adds a get attribute export to the given template.

func CloudAddExpRef

func CloudAddExpRef(tpl *gocf.Template, p Plugin, ref CloudRef)

CloudAddExpRef adds a reference export to the given template.

func CloudGetDefaultTags

func CloudGetDefaultTags(name string) *[]gotags.Tag

CloudGetDefaultTags returns a set of default tags.

func CloudGetStackName

func CloudGetStackName(p Plugin) string

CloudGetStackName generates a stack name for the given plugin.

func CloudGetTaskDefinitionKeyValuePairs

func CloudGetTaskDefinitionKeyValuePairs(m map[string]string) *[]goecs.TaskDefinition_KeyValuePair

CloudGetTaskDefinitionKeyValuePairs converts a map of strings to a slice of TaskDefinition_KeyValuePair.

func LocalGetContainerName

func LocalGetContainerName(p Plugin, additionalParts ...string) string

LocalGetContainerName generates a container name for the given plugin.

func NewAssumeRolePolicyDocument

func NewAssumeRolePolicyDocument(service string) interface{}

NewAssumeRolePolicyDocument generates a new assume role policy document.

func NewPolicyDocument

func NewPolicyDocument(statements ...*PolicyStatement) interface{}

NewPolicyDocument generates a new policy document.

Types

type App

type App interface {
	GetConfig() *AppConfig
	GetBuildDirPath(p Plugin, additionalParts ...string) string
	GetConfigDirPath(p Plugin, additionalParts ...string) string
	GetOperations() toolz.Operations
	GetSortedPlugins() [][]Plugin
}

App describes an App.

func NewApp

func NewApp(cfg *AppConfig) App

NewApp initializes a new App.

type AppConfig

type AppConfig struct {
	DisplayName   string      `validate:"required"`
	Name          string      `validate:"required,resource-name"`
	ConfigDirPath string      `validate:"required,dir"`
	BuildDirPath  string      `validate:"required,parent-dir"`
	AWSConfig     *aws.Config `validate:"required"`
	Plugins       []Plugin    `validate:"required"`
}

AppConfig describes the app config.

func (*AppConfig) MustValidate

func (c *AppConfig) MustValidate()

MustValidate validates the app config.

type CloudAtt

type CloudAtt string

CloudAtt describes a cloud attribute.

func (CloudAtt) Name

func (a CloudAtt) Name() string

Name returns a name.

func (CloudAtt) Ref

func (a CloudAtt) Ref() string

Ref returns a reference.

type CloudExports

type CloudExports interface {
	GetRef(ref CloudRef) string
	GetAtt(ref CloudRef, att CloudAtt) string
}

CloudExports describes a set of cloud exports.

func NewCloudExports

func NewCloudExports(stack *awscft.Stack) CloudExports

NewCloudExports initializes a new set of cloud exports.

type CloudRef

type CloudRef string

CloudRef describes a cloud reference.

func (CloudRef) ExpAttName

func (r CloudRef) ExpAttName(p Plugin, att CloudAtt) string

ExpAttName returns a name for an attribute export.

func (CloudRef) ExpAttRef

func (r CloudRef) ExpAttRef(att CloudAtt) string

ExpAttRef returns a reference to an attribute export.

func (CloudRef) ExpRefName

func (r CloudRef) ExpRefName(p Plugin) string

ExpRefName returns a name for a reference export.

func (CloudRef) ExpRefRef

func (r CloudRef) ExpRefRef() string

ExpRefRef returns a reference to a reference export.

func (CloudRef) Name

func (r CloudRef) Name(p Plugin) string

Name returns a name.

func (CloudRef) Ref

func (r CloudRef) Ref() string

Ref returns a reference.

type CloudStage

type CloudStage interface {
	Stage
	GetCloudConfig() *CloudStageConfig
	GetArtifactsKeyPrefix(p Plugin, additionalParts ...string) string
	IsDeployed() bool
}

CloudStage describes a cloud Stage.

func NewCloudStage

func NewCloudStage(cfg *CloudStageConfig) CloudStage

NewCloudStage initializes a new CloudStage.

type CloudStageConfig

type CloudStageConfig struct {
	*StageConfig `validate:"required"`
	Name         string    `validate:"required,resource-name"`
	Version      string    `validate:"required"`
	Mode         StageMode `validate:"required,oneof=production|staging"`
}

CloudStageConfig describes the Stage cloud config.

func (*CloudStageConfig) MustValidate

func (c *CloudStageConfig) MustValidate()

MustValidate validates the cloud stage config.

type LocalStage

type LocalStage interface {
	Stage
	GetLocalConfig() *LocalStageConfig
	GetServiceNetworkConfig() map[string]*dctypes.ServiceNetworkConfig
}

LocalStage describes a local Stage.

func NewLocalStage

func NewLocalStage(cfg *LocalStageConfig) LocalStage

NewLocalStage initializes a new LocalStage.

type LocalStageConfig

type LocalStageConfig struct {
	*StageConfig `validate:"required"`
}

LocalStageConfig describes the local Stage config.

func (*LocalStageConfig) MustValidate

func (c *LocalStageConfig) MustValidate()

MustValidate validates the local stage config.

type OtherDependencies

type OtherDependencies []Plugin

OtherDependencies describes a set of unstructured dependencies.

func (OtherDependencies) Find

func (d OtherDependencies) Find(name string, instanceName *string) Plugin

Find looks a dependency given plugin name and instance name. Returns nil if not found.

type Plugin

type Plugin interface {
	GetDisplayName() string
	GetName() string
	GetInstanceName() *string // nil for singleton Plugins
	GetDependenciesMap() map[Plugin]struct{}
	Configure(stage Stage)
	GetStage() Stage
	IsDeployed() bool
	UpdateLocalTemplate(tpl *dctypes.Config, buildDirPath string)
	GetCloudTemplate(buildDirPath string) *gocf.Template
	UpdateCloudMetadata(stack *awscft.Stack)
	BeforeDeployHook(buildDirPath string)
	AfterDeployHook(buildDirPath string)
}

Plugin describes a plugin, i.e. a set of behaviors, tools, and components.

type PolicyStatement

type PolicyStatement struct {
	Actions   []string
	Resources []string
	Principal interface{}
}

PolicyStatement describes a policy statement.

func NewPolicyStatement

func NewPolicyStatement() *PolicyStatement

NewPolicyStatement initializes a new PolicyStatement.

func (*PolicyStatement) AddActions

func (s *PolicyStatement) AddActions(actions ...string) *PolicyStatement

AddActions adds actions to the policy statement.

func (*PolicyStatement) AddResources

func (s *PolicyStatement) AddResources(resources ...string) *PolicyStatement

AddResources adds resources to the policy statement.

func (*PolicyStatement) Build

func (s *PolicyStatement) Build() interface{}

Build builds the policy statement.

func (*PolicyStatement) SetAnyRootAccountPrincipal

func (s *PolicyStatement) SetAnyRootAccountPrincipal() *PolicyStatement

SetAnyRootAccountPrincipal sets any root account as principal on the policy statement.

func (*PolicyStatement) SetCurrentRootAccountPrincipal

func (s *PolicyStatement) SetCurrentRootAccountPrincipal() *PolicyStatement

SetCurrentRootAccountPrincipal sets the current root account as principal on the policy statement.

func (*PolicyStatement) SetServicePrincipal

func (s *PolicyStatement) SetServicePrincipal(service string) *PolicyStatement

SetServicePrincipal sets a service as principal on the policy statement.

func (*PolicyStatement) SetWildcardPrincipal

func (s *PolicyStatement) SetWildcardPrincipal() *PolicyStatement

SetWildcardPrincipal sets a wildcard as principal on the policy statement.

type Stage

type Stage interface {
	GetName() string
	GetTarget() StageTarget
	GetMode() StageMode
	GetConfig() *StageConfig
	AsCloudStage() CloudStage
	AsLocalStage() LocalStage
	Deploy()
}

Stage describes a Stage.

type StageConfig

type StageConfig struct {
	App          App `validate:"required"`
	CustomConfig interface{}
}

StageConfig describes the common config for a stage.

type StageMode

type StageMode string

StageMode describes a Stage mode.

const (
	Production StageMode = "prod"
	Staging    StageMode = "staging"
)

Known Stage modes.

func (StageMode) IsProduction

func (s StageMode) IsProduction() bool

IsProduction returns true if the Stage mode is Production.

func (StageMode) IsStaging

func (s StageMode) IsStaging() bool

IsStaging returns true if the Stage mode is Staging.

func (StageMode) MustValidate

func (s StageMode) MustValidate()

MustValidate validates the StageMode.

func (StageMode) String

func (s StageMode) String() string

String implements the fmt.Stringer interface.

type StageTarget

type StageTarget string

StageTarget describes a Stage target.

const (
	Local StageTarget = "local"
	Cloud StageTarget = "cloud"
)

Known Stage targets.

func (StageTarget) IsCloud

func (s StageTarget) IsCloud() bool

IsCloud returns true if the Stage target is Cloud.

func (StageTarget) IsLocal

func (s StageTarget) IsLocal() bool

IsLocal returns true if the Stage target is Local.

func (StageTarget) MustValidate

func (s StageTarget) MustValidate()

MustValidate validates the StageTarget.

func (StageTarget) String

func (s StageTarget) String() string

String implements the fmt.Stringer interface.

Jump to

Keyboard shortcuts

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