models

package
v0.0.0-...-b659250 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2016 License: Apache-2.0, Apache-2.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomTopic = os.Getenv("CUSTOM_TOPIC")
View Source
var DEPLOYMENT_TIMEOUT = 10 * time.Minute
View Source
var DescribeStacksCache = map[string]DescribeStacksResult{}
View Source
var DescribeStacksCacheTTL = 5 * time.Second
View Source
var DescribeStacksMutex = &sync.Mutex{}
View Source
var ErrPending = errors.New("can not get docker client for non-running container")
View Source
var ManifestRandomPorts = true

set to false when testing for deterministic ports

View Source
var NotificationHost = os.Getenv("NOTIFICATION_HOST")
View Source
var NotificationTopic = os.Getenv("NOTIFICATION_TOPIC")
View Source
var PauseNotifications = false
View Source
var SortableTime = "20060102.150405.000000000"
View Source
var StatusCodePrefix = client.StatusCodePrefix

Functions

func ACM

func ACM() *acm.ACM

func AppDockerLogin

func AppDockerLogin(app App) (string, error)

Log into the appropriate registry for the given app This could be the self-hosted v1 registry or an ECR registry

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func AutoScaling

func AutoScaling() *autoscaling.AutoScaling

func AwsCamelize

func AwsCamelize(dasherized string) string

func CFParams

func CFParams(source map[string]string) map[string]string

turns a dasherized map of key/value CLI params to parameters that CloudFormation expects

func CloudFormation

func CloudFormation() *cloudformation.CloudFormation

func CloudWatch

func CloudWatch() *cloudwatch.CloudWatch

func CloudWatchLogs

func CloudWatchLogs() *cloudwatchlogs.CloudWatchLogs

func DashName

func DashName(name string) string

func DescribeStack

func DescribeStack(name string) (*cloudformation.DescribeStacksOutput, error)

func DescribeStacks

func DescribeStacks() (*cloudformation.DescribeStacksOutput, error)

func Docker

func Docker(host string) (*docker.Client, error)

func DockerHost

func DockerHost() (string, error)

func DockerLogin

func DockerLogin(ac docker.AuthConfiguration) (string, error)

func DockerLogout

func DockerLogout(ac docker.AuthConfiguration) error

func DynamoDB

func DynamoDB() *dynamodb.DynamoDB

func EC2

func EC2() *ec2.EC2

func ECR

func ECR() *ecr.ECR

func ECS

func ECS() *ecs.ECS

func ELB

func ELB() *elb.ELB

func GenerateSelfSignedCertificate

func GenerateSelfSignedCertificate(host string) ([]byte, []byte, error)

func GetAppServices

func GetAppServices(app string) ([]*ecs.Service, error)

func IAM

func IAM() *iam.IAM

func InstanceKeyroll

func InstanceKeyroll() error

func InstanceSSH

func InstanceSSH(id, command, term string, height, width int, rw io.ReadWriter) error

func Kinesis

func Kinesis() *kinesis.Kinesis

func LoginPrivateRegistries

func LoginPrivateRegistries() error

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func Notify

func Notify(name, status string, data map[string]string) error

func NotifyError

func NotifyError(action string, err error, data map[string]string) error

uniform error handling

func NotifySuccess

func NotifySuccess(action string, data map[string]string) error

func PullAppImages

func PullAppImages()

func PutEnvironment

func PutEnvironment(app string, env Environment) (string, error)

func PutRackSettings

func PutRackSettings(env Environment) error

func RDS

func RDS() *rds.RDS

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func S3

func S3() *s3.S3

func S3Put

func S3Put(bucket, key string, data []byte, public bool) error

func S3PutFile

func S3PutFile(bucket, key string, f io.ReadSeeker, public bool) error

func SNS

func SNS() *sns.SNS

func SQS

func SQS() *sqs.SQS

func SetFormation

func SetFormation(app, process string, count, memory int64) error

Update Process Parameters for Count and Memory Expects -1 for count or memory to indicate no change, since count=0 is valid

func SettingGet

func SettingGet(name string) (string, error)

func SettingSet

func SettingSet(name, value string) error

func UpperName

func UpperName(name string) string

Types

type App

type App struct {
	Name    string `json:"name"`
	Release string `json:"release"`
	Status  string `json:"status"`

	Outputs    map[string]string `json:"-"`
	Parameters map[string]string `json:"-"`
	Tags       map[string]string `json:"-"`
}

func GetApp

func GetApp(name string) (*App, error)

func GetAppBound

func GetAppBound(name string) (*App, error)

func GetAppUnbound

func GetAppUnbound(name string) (*App, error)

func (*App) BalancerHost

func (a *App) BalancerHost() string

func (*App) BalancerPorts

func (a *App) BalancerPorts(ps string) map[string]string

func (*App) Cleanup

func (a *App) Cleanup() error

func (*App) Create

func (a *App) Create() error

func (*App) Delete

func (a *App) Delete() error

func (*App) ExecAttached

func (a *App) ExecAttached(pid, command string, height, width int, rw io.ReadWriter) error

func (*App) ForkRelease

func (a *App) ForkRelease() (*Release, error)

func (*App) Formation

func (a *App) Formation() (string, error)

func (*App) IsBound

func (a *App) IsBound() bool

func (*App) LatestRelease

func (a *App) LatestRelease() (*Release, error)

FIXME: Port to provider interface

func (*App) ProcessPorts

func (a *App) ProcessPorts(ps string) map[string]string

func (*App) Resources

func (a *App) Resources() (Resources, error)

func (*App) RunAttached

func (a *App) RunAttached(process, command, releaseId string, height, width int, rw io.ReadWriter) error

func (*App) RunDetached

func (a *App) RunDetached(process, command, releaseId string) error

func (*App) StackName

func (a *App) StackName() string

func (*App) TaskDefinitionFamily

func (a *App) TaskDefinitionFamily() string

func (*App) UpdateParams

func (a *App) UpdateParams(changes map[string]string) error

Shortcut for updating current parameters If template changed, more care about new or removed parameters must be taken (see Release.Promote or System.Save)

type Apps

type Apps []App

func ListApps

func ListApps() (Apps, error)

func (Apps) Len

func (s Apps) Len() int

func (Apps) Less

func (s Apps) Less(i, j int) bool

func (Apps) Swap

func (s Apps) Swap(i, j int)

type CronJob

type CronJob struct {
	Name          string `yaml:"name"`
	Schedule      string `yaml:"schedule"`
	Command       string `yaml:"command"`
	ManifestEntry *ManifestEntry
}

func NewCronJobFromLabel

func NewCronJobFromLabel(key, value string) CronJob

func (*CronJob) AppName

func (cr *CronJob) AppName() string

func (*CronJob) LongName

func (cr *CronJob) LongName() string

func (*CronJob) Process

func (cr *CronJob) Process() string

func (*CronJob) ShortName

func (cr *CronJob) ShortName() string

type Deployment

type Deployment struct {
	Status  string
	Release string

	Desired int64
	Pending int64
	Running int64

	Created time.Time
}

type Deployments

type Deployments []Deployment

func ListDeployments

func ListDeployments(app string) (Deployments, error)

type DescribeStacksResult

type DescribeStacksResult struct {
	Name        string
	Output      *cloudformation.DescribeStacksOutput
	RequestTime time.Time
}

type ECSEvents

type ECSEvents []*ecs.ServiceEvent

func (ECSEvents) CapacityWarning

func (events ECSEvents) CapacityWarning() string

func (ECSEvents) HasCapacityWarning

func (events ECSEvents) HasCapacityWarning() bool

type ECSServices

type ECSServices []*ecs.Service

func ClusterServices

func ClusterServices() (ECSServices, error)

func (ECSServices) EventsSince

func (services ECSServices) EventsSince(since time.Time) ECSEvents

func (ECSServices) IsConverged

func (services ECSServices) IsConverged() bool

func (ECSServices) LastEvent

func (services ECSServices) LastEvent() ecs.ServiceEvent

type Environment

type Environment map[string]string

func GetEnvironment

func GetEnvironment(app string) (Environment, error)

func GetPrivateRegistriesAuth

func GetPrivateRegistriesAuth() (Environment, docker.AuthConfigurations119, error)

func GetRackSettings

func GetRackSettings() (Environment, error)

Use the Rack Settings bucket and EncryptionKey KMS key to store and retrieve sensitive credentials, just like app env

func LoadEnvironment

func LoadEnvironment(data []byte) Environment

func (Environment) Raw

func (e Environment) Raw() string

func (Environment) SortedNames

func (e Environment) SortedNames() []string

type Formation

type Formation []FormationEntry

func ListFormation

func ListFormation(app string) (Formation, error)

func (Formation) Entry

func (f Formation) Entry(name string) *FormationEntry

func (Formation) Len

func (f Formation) Len() int

func (Formation) Less

func (f Formation) Less(a, b int) bool

func (Formation) Swap

func (f Formation) Swap(a, b int)

type FormationEntry

type FormationEntry struct {
	Balancer string `json:"balancer"`
	Name     string `json:"name"`
	Count    int    `json:"count"`
	Memory   int    `json:"memory"`
	Ports    []int  `json:"ports"`
}

type Manifest

type Manifest []ManifestEntry

func LoadManifest

func LoadManifest(data string, app *App) (Manifest, error)

func (Manifest) AppName

func (m Manifest) AppName() string

func (Manifest) BalancerResourceName

func (m Manifest) BalancerResourceName(process string) string

func (Manifest) Balancers

func (m Manifest) Balancers() []ManifestBalancer

func (Manifest) CronJobs

func (m Manifest) CronJobs() []CronJob

func (Manifest) Entry

func (m Manifest) Entry(name string) *ManifestEntry

func (Manifest) EntryNames

func (m Manifest) EntryNames() []string

func (Manifest) Formation

func (m Manifest) Formation() (string, error)

func (Manifest) GetBalancer

func (m Manifest) GetBalancer(name string) *ManifestBalancer

func (Manifest) HasExternalPorts

func (m Manifest) HasExternalPorts() bool

func (Manifest) HasProcesses

func (m Manifest) HasProcesses() bool

func (Manifest) Rack

func (m Manifest) Rack() string

type ManifestBalancer

type ManifestBalancer struct {
	Entry  ManifestEntry
	Public bool
}

func (ManifestBalancer) ExternalPorts

func (mb ManifestBalancer) ExternalPorts() []string

func (ManifestBalancer) FirstPort

func (mb ManifestBalancer) FirstPort() string

func (ManifestBalancer) InternalPorts

func (mb ManifestBalancer) InternalPorts() []string

func (ManifestBalancer) LoadBalancerName

func (mb ManifestBalancer) LoadBalancerName() template.HTML

func (ManifestBalancer) PortMappings

func (mb ManifestBalancer) PortMappings() []ManifestPort

func (ManifestBalancer) Ports

func (mb ManifestBalancer) Ports() []string

func (ManifestBalancer) ProcessName

func (mb ManifestBalancer) ProcessName() string

func (ManifestBalancer) Randoms

func (mb ManifestBalancer) Randoms() map[string]int

func (ManifestBalancer) ResourceName

func (mb ManifestBalancer) ResourceName() string

func (ManifestBalancer) Scheme

func (mb ManifestBalancer) Scheme() string

type ManifestEntries

type ManifestEntries map[string]ManifestEntry

type ManifestEntry

type ManifestEntry struct {
	Name string

	Build      string                   `yaml:"build"`
	Command    interface{}              `yaml:"command"`
	Env        MapOrEqualSlice          `yaml:"environment"`
	Exports    map[string]string        `yaml:"-"`
	Image      string                   `yaml:"image"`
	Labels     interface{}              `yaml:"labels"`
	Links      []string                 `yaml:"links"`
	LinkVars   map[string]template.HTML `yaml:"-"`
	Ports      []string                 `yaml:"ports"`
	Privileged bool                     `yaml:"privileged"`
	Volumes    []string                 `yaml:"volumes"`
	// contains filtered or unexported fields
}

func (*ManifestEntry) BalancerResourceName

func (me *ManifestEntry) BalancerResourceName() string

func (*ManifestEntry) CommandArray

func (me *ManifestEntry) CommandArray() []string

func (*ManifestEntry) CommandString

func (me *ManifestEntry) CommandString() string

func (ManifestEntry) ContainerPorts

func (me ManifestEntry) ContainerPorts() []string

func (ManifestEntry) EnvMap

func (me ManifestEntry) EnvMap() map[string]string

func (ManifestEntry) ExternalPorts

func (me ManifestEntry) ExternalPorts() []string

func (ManifestEntry) HasBalancer

func (me ManifestEntry) HasBalancer() bool

func (ManifestEntry) InternalPorts

func (me ManifestEntry) InternalPorts() []string

func (ManifestEntry) Label

func (me ManifestEntry) Label(key string) string

func (ManifestEntry) LabelsByPrefix

func (me ManifestEntry) LabelsByPrefix(prefix string) map[string]string

func (ManifestEntry) MountableVolumes

func (me ManifestEntry) MountableVolumes() []string

func (ManifestEntry) PortMappings

func (me ManifestEntry) PortMappings() []ManifestPort

func (ManifestEntry) Randoms

func (me ManifestEntry) Randoms() map[string]int

func (ManifestEntry) RegistryImage

func (me ManifestEntry) RegistryImage(app *App, buildId string) string

type ManifestPort

type ManifestPort struct {
	Balancer  string
	Container string
	Public    bool
}

type MapOrEqualSlice

type MapOrEqualSlice []string

func (*MapOrEqualSlice) UnmarshalYAML

func (s *MapOrEqualSlice) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the Unmarshaller interface.

type Process

type Process struct {
	Id      string    `json:"id"`
	App     string    `json:"app"`
	Command string    `json:"command"`
	Host    string    `json:"host"`
	Image   string    `json:"image"`
	Name    string    `json:"name"`
	Ports   []string  `json:"ports"`
	Release string    `json:"release"`
	Size    int64     `json:"size"`
	Cpu     float64   `json:"cpu"`
	Memory  float64   `json:"memory"`
	Started time.Time `json:"started"`
	// contains filtered or unexported fields
}

func GetProcess

func GetProcess(app, id string) (*Process, error)

func ListPendingProcesses

func ListPendingProcesses(app string) ([]*Process, error)

func ListProcesses

func ListProcesses(app string) ([]*Process, error)

func (*Process) Docker

func (p *Process) Docker() (*docker.Client, error)

func (*Process) FetchStats

func (p *Process) FetchStats() error

func (*Process) Stop

func (p *Process) Stop() error

type Processes

type Processes []*Process

func ListOneoffProcesses

func ListOneoffProcesses(app string) (Processes, error)

func (Processes) Len

func (ps Processes) Len() int

func (Processes) Less

func (ps Processes) Less(i, j int) bool

Sort processes by name and id Processes with a 'pending' id will naturally come last by design

func (Processes) Swap

func (ps Processes) Swap(i, j int)

type Release

type Release struct {
	Id       string    `json:"id"`
	App      string    `json:"app"`
	Build    string    `json:"build"`
	Env      string    `json:"env"`
	Manifest string    `json:"manifest"`
	Created  time.Time `json:"created"`
}

func GetRelease

func GetRelease(app, id string) (*Release, error)

func NewRelease

func NewRelease(app string) Release

func (*Release) EnvironmentUrl

func (r *Release) EnvironmentUrl() string

func (*Release) Formation

func (r *Release) Formation() (string, error)

func (*Release) Promote

func (r *Release) Promote() error

func (*Release) Save

func (r *Release) Save() error

type Releases

type Releases []Release

type Resource

type Resource struct {
	Id   string
	Name string

	Reason string
	Status string
	Type   string

	Time time.Time
}

type Resources

type Resources map[string]Resource

func ListResources

func ListResources(app string) (Resources, error)

type SSL

type SSL struct {
	Certificate string    `json:"certificate"`
	Expiration  time.Time `json:"expiration"`
	Domain      string    `json:"domain"`
	Process     string    `json:"process"`
	Port        int       `json:"port"`
	Secure      bool      `json:"secure"`
}

func UpdateSSL

func UpdateSSL(app, process string, port int, id string) (*SSL, error)

type SSLs

type SSLs []SSL

func ListSSLs

func ListSSLs(a string) (SSLs, error)

type Service

type Service client.Service

func GetService

func GetService(name string) (*Service, error)

func GetServiceBound

func GetServiceBound(name string) (*Service, error)

func GetServiceUnbound

func GetServiceUnbound(name string) (*Service, error)

func (*Service) Create

func (s *Service) Create() error

func (*Service) CreateDatastore

func (s *Service) CreateDatastore() (*cloudformation.CreateStackInput, error)

func (*Service) CreatePapertrail

func (s *Service) CreatePapertrail() (*cloudformation.CreateStackInput, error)

func (*Service) CreateS3

func (s *Service) CreateS3() (*cloudformation.CreateStackInput, error)

func (*Service) CreateSNS

func (s *Service) CreateSNS() (*cloudformation.CreateStackInput, error)

func (*Service) CreateSQS

func (s *Service) CreateSQS() (*cloudformation.CreateStackInput, error)

func (*Service) CreateWebhook

func (s *Service) CreateWebhook() (*cloudformation.CreateStackInput, error)

func (*Service) Delete

func (s *Service) Delete() error

func (*Service) Formation

func (s *Service) Formation() (string, error)

func (*Service) IsBound

func (s *Service) IsBound() bool

func (*Service) LinkPapertrail

func (s *Service) LinkPapertrail(app App) error

func (*Service) StackName

func (s *Service) StackName() string

func (*Service) UnlinkPapertrail

func (s *Service) UnlinkPapertrail(app App) error

func (*Service) Update

func (s *Service) Update(changes map[string]string) error

Service Update takes a map of CF Parameter changes and applies on top of the existing parameters and the newest template. The CLI / Client / Server delegates everything to CloudFormation, and makes no guarantees of service uptime during update. In fact, most datastore updates guarantee resource replacement which will cause database downtime.

func (*Service) UpdateDatastore

func (s *Service) UpdateDatastore() (*cloudformation.UpdateStackInput, error)

func (*Service) UpdateIAMService

func (s *Service) UpdateIAMService() (*cloudformation.UpdateStackInput, error)

S3, SNS, SQS create an IAM user, therefore require IAM capabilitites for updates

func (*Service) UpdatePapertrail

func (s *Service) UpdatePapertrail(arns map[string]string) error

type Services

type Services []Service

func ListServices

func ListServices() (Services, error)

func (Services) Len

func (ss Services) Len() int

func (Services) Less

func (ss Services) Less(i, j int) bool

func (Services) Swap

func (ss Services) Swap(i, j int)

type Template

type Template struct {
	Parameters map[string]TemplateParameter
}

type TemplateParameter

type TemplateParameter struct {
	Default     string
	Description string
	Type        string
}

type Transaction

type Transaction struct {
	Name   string
	Type   string
	Status string
	Start  time.Time
	End    time.Time
}

A Transaction groups more than one event on a Name/Type resource

type Transactions

type Transactions []Transaction

func (Transactions) Len

func (slice Transactions) Len() int

func (Transactions) Less

func (slice Transactions) Less(i, j int) bool

func (Transactions) Swap

func (slice Transactions) Swap(i, j int)

Jump to

Keyboard shortcuts

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