cloudformation

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: BSD-2-Clause Imports: 23 Imported by: 0

README

This provides an interface for CloudFormation Custom Resources so that Empire can provision things for CloudFormation. It supports the following resources:

  • Custom::InstancePort: Allocates an instance port from the pool of instance ports.

Documentation

Overview

Package cloudformation provides a server for the CloudFormation interface to Empire.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Allow custom resource provisioners this amount of time do their
	// thing.
	ProvisioningTimeout = time.Duration(20 * time.Minute)

	// And this amount of time to cleanup when they're canceled.
	ProvisioningGraceTimeout = time.Duration(1 * time.Minute)
)

Functions

This section is empty.

Types

type AppProperties added in v0.11.0

type AppProperties struct {
	Name *string
}

AppProperties represents the properties for the Custom::EmpireApp

type ContainerDefinition added in v0.11.0

type ContainerDefinition struct {
	Name             *string
	Command          []*string
	Cpu              *customresources.IntValue
	Image            *string
	Essential        *string
	Memory           *customresources.IntValue
	PortMappings     []PortMapping
	DockerLabels     map[string]*string
	Ulimits          []Ulimit
	Environment      []string
	LogConfiguration *ecs.LogConfiguration
}

type CustomResourceProvisioner

type CustomResourceProvisioner struct {
	*SQSDispatcher

	// Provisioners routes a custom resource to the thing that should do the
	// provisioning.
	Provisioners map[string]customresources.Provisioner
	// contains filtered or unexported fields
}

CustomResourceProvisioner polls for CloudFormation Custom Resource requests from an sqs queue, provisions them, then responds back.

func NewCustomResourceProvisioner

func NewCustomResourceProvisioner(empire *empire.Empire, config client.ConfigProvider) *CustomResourceProvisioner

NewCustomResourceProvisioner returns a new CustomResourceProvisioner with an sqs client configured from config.

func (*CustomResourceProvisioner) Handle

func (c *CustomResourceProvisioner) Handle(ctx context.Context, message *sqs.Message) error

Handle handles a single sqs.Message to perform the provisioning.

func (*CustomResourceProvisioner) Start

func (c *CustomResourceProvisioner) Start()

type ECSEnvironmentProperties added in v0.11.0

type ECSEnvironmentProperties struct {
	Environment []*ecs.KeyValuePair
}

ECSEnvironmentProperties are the properties provided to the Custom::ECSEnvironment custom resource.

func (*ECSEnvironmentProperties) ReplacementHash added in v0.11.0

func (p *ECSEnvironmentProperties) ReplacementHash() (uint64, error)

type ECSEnvironmentResource added in v0.11.0

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

ECSEnvironmentResource is a custom resource that takes some environment variables, stores them, then returns a unique identifier to represent the environment, which can be used with the ECSTaskDefinitionResource.

func (*ECSEnvironmentResource) Create added in v0.11.0

func (p *ECSEnvironmentResource) Create(ctx context.Context, req customresources.Request) (string, interface{}, error)

func (*ECSEnvironmentResource) Delete added in v0.11.0

type ECSPlacementConstraint added in v0.13.0

type ECSPlacementConstraint struct {
	Type       *string
	Expression *string
}

type ECSPlacementStrategy added in v0.13.0

type ECSPlacementStrategy struct {
	Type  *string
	Field *string
}

type ECSServiceProperties

type ECSServiceProperties struct {
	ServiceName          *string
	Cluster              *string
	DesiredCount         *customresources.IntValue `hash:"ignore"`
	LoadBalancers        []LoadBalancer
	Role                 *string
	TaskDefinition       *string `hash:"ignore"`
	PlacementConstraints []ECSPlacementConstraint
	PlacementStrategy    []ECSPlacementStrategy
}

ECSServiceProperties represents the properties for the Custom::ECSService resource.

func (*ECSServiceProperties) ReplacementHash added in v0.13.0

func (p *ECSServiceProperties) ReplacementHash() (uint64, error)

type ECSServiceResource

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

ECSServiceResource is a Provisioner that creates and updates ECS services.

func (*ECSServiceResource) Create added in v0.13.0

func (p *ECSServiceResource) Create(ctx context.Context, req customresources.Request) (string, interface{}, error)

func (*ECSServiceResource) Delete added in v0.13.0

func (*ECSServiceResource) Update added in v0.13.0

func (p *ECSServiceResource) Update(ctx context.Context, req customresources.Request) (interface{}, error)

type ECSTaskDefinitionProperties added in v0.11.0

type ECSTaskDefinitionProperties struct {
	Family               *string
	TaskRoleArn          *string
	ContainerDefinitions []ContainerDefinition
	PlacementConstraints []ECSPlacementConstraint
}

TaskDefinitionProperties are properties passed to the Custom::ECSTaskDefinition custom resource.

func (*ECSTaskDefinitionProperties) ReplacementHash added in v0.11.0

func (p *ECSTaskDefinitionProperties) ReplacementHash() (uint64, error)

type ECSTaskDefinitionResource added in v0.11.0

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

ECSTaskDefinitionResource is a custom resource that provisions ECS task definitions.

func (*ECSTaskDefinitionResource) Create added in v0.11.0

func (p *ECSTaskDefinitionResource) Create(ctx context.Context, req customresources.Request) (string, interface{}, error)

func (*ECSTaskDefinitionResource) Delete added in v0.11.0

type EmpireAppEnvironmentResource added in v0.11.0

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

EmpireAppEnvironmentResource is a Provisioner that manages environmental variables within an Empire application.

func (*EmpireAppEnvironmentResource) Properties added in v0.11.0

func (p *EmpireAppEnvironmentResource) Properties() interface{}

func (*EmpireAppEnvironmentResource) Provision added in v0.11.0

func (p *EmpireAppEnvironmentResource) Provision(ctx context.Context, req customresources.Request) (id string, data interface{}, err error)

type EmpireAppResource added in v0.11.0

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

EmpireAppResource is a Provisioner that will manage an Empire application

func (*EmpireAppResource) Properties added in v0.11.0

func (p *EmpireAppResource) Properties() interface{}

func (*EmpireAppResource) Provision added in v0.11.0

func (p *EmpireAppResource) Provision(ctx context.Context, req customresources.Request) (id string, data interface{}, err error)

type EnvironmentProperties added in v0.11.0

type EnvironmentProperties struct {
	AppId     *string
	Variables []Variable
}

EnvironmentProperties represents the properties for the Custom::EmpireAppEnvironment

type InstancePortsResource added in v0.13.0

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

InstancePortsResource is a Provisioner that allocates instance ports.

func (*InstancePortsResource) Create added in v0.13.0

func (p *InstancePortsResource) Create(_ context.Context, req customresources.Request) (string, interface{}, error)

func (*InstancePortsResource) Delete added in v0.13.0

func (*InstancePortsResource) Properties added in v0.13.0

func (p *InstancePortsResource) Properties() interface{}

type LoadBalancer

type LoadBalancer struct {
	ContainerName    *string
	ContainerPort    *customresources.IntValue
	LoadBalancerName *string
	TargetGroupArn   *string
}

type Message

type Message struct {
	Message string `json:"Message"`
}

Represents the body of the SQS message, which would have been received from SNS.

type PortMapping added in v0.11.0

type PortMapping struct {
	ContainerPort *customresources.IntValue
	HostPort      *customresources.IntValue
}

type SQSDispatcher added in v0.11.0

type SQSDispatcher struct {
	// Root context.Context to use. If a reporter.Reporter is embedded,
	// errors generated will be reporter there. If a logger.Logger is
	// embedded, logging will be logged there.
	Context context.Context

	// The SQS queue url to listen for CloudFormation Custom Resource
	// requests.
	QueueURL string

	// When a message is pulled off of sqs, the visibility timeout will be
	// extended by this much, and periodically extended while the handler
	// performs it's work. If this process crashes, then the sqs message
	// will be redelivered later.
	VisibilityHeartbeat time.Duration

	// Number of worker goroutines to start for receiving messages.
	NumWorkers int
	// contains filtered or unexported fields
}

SQSDispatcher pulls messages from SQS, and dispatches them to a handler.

func (*SQSDispatcher) Start added in v0.11.0

func (q *SQSDispatcher) Start(handle func(context.Context, *sqs.Message) error)

Start starts multiple goroutines pulling messages off of the queue.

func (*SQSDispatcher) Stop added in v0.11.0

func (q *SQSDispatcher) Stop()

type Ulimit added in v0.11.0

type Ulimit struct {
	Name      *string
	HardLimit *customresources.IntValue
	SoftLimit *customresources.IntValue
}

type Variable added in v0.11.0

type Variable struct {
	Name  *string
	Value *string
}

type VariableError added in v0.11.0

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

func (*VariableError) Error added in v0.11.0

func (v *VariableError) Error() string

Jump to

Keyboard shortcuts

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