models

package
v0.0.0-...-4caa87e Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2016 License: Apache-2.0, Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const KERNEL_URL = "https://convox.s3.amazonaws.com/kernel.json"

Variables

View Source
var CustomTopic = os.Getenv("CUSTOM_TOPIC")
View Source
var DEPLOYMENT_TIMEOUT = 10 * time.Minute
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 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 Docker

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

func DockerHost

func DockerHost() (string, error)

func DockerLogin

func DockerLogin(ac docker.AuthConfiguration) 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 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 KernelUpdate

func KernelUpdate() error

func Kinesis

func Kinesis() *kinesis.Kinesis

func LoginRegistries

func LoginRegistries() 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 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, count, memory string) error

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 (*App) BalancerHost

func (a *App) BalancerHost() string

func (*App) BalancerPorts

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

func (*App) Builds

func (a *App) Builds() Builds

func (*App) Cleanup

func (a *App) Cleanup() error

func (*App) Create

func (a *App) Create() error

func (*App) Created

func (a *App) Created() bool

func (*App) Delete

func (a *App) Delete() error

func (*App) Deployments

func (a *App) Deployments() Deployments

func (*App) ELBReady

func (a *App) ELBReady() bool

func (*App) ExecAttached

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

func (*App) ForkRelease

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

func (*App) Formation

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

func (*App) HealthCheck

func (a *App) HealthCheck() string

func (*App) HealthCheckEndpoint

func (a *App) HealthCheckEndpoint() string

func (*App) HealthCheckEndpoints

func (a *App) HealthCheckEndpoints() []string

func (*App) HealthCheckPath

func (a *App) HealthCheckPath() string

func (*App) LatestRelease

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

func (*App) Metrics

func (a *App) Metrics() *Metrics

func (*App) ProcessPorts

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

func (*App) Processes

func (a *App) Processes() Processes

func (*App) Releases

func (a *App) Releases() Releases

func (*App) Resources

func (a *App) Resources() Resources

func (*App) RunAttached

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

func (*App) RunDetached

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

func (*App) SubscribeLogs

func (a *App) SubscribeLogs(output chan []byte, quit chan bool) error

During the transition from Kinesis to CloudWatch Logs, apps might not have been re-deployed and provisioned a LogGroup. Conditionally fall back to reading from Kinesis in this case.

func (*App) TaskDefinitionFamily

func (a *App) TaskDefinitionFamily() string

func (*App) UpdateParams

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

func (*App) UpdateParamsAndTemplate

func (a *App) UpdateParamsAndTemplate(changes map[string]string, template string) error

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 Build

type Build struct {
	Id       string `json:"id"`
	App      string `json:"app"`
	Logs     string `json:"logs"`
	Manifest string `json:"manifest"`
	Release  string `json:"release"`
	Status   string `json:"status"`

	Started time.Time `json:"started"`
	Ended   time.Time `json:"ended"`
	// contains filtered or unexported fields
}

func GetBuild

func GetBuild(app, id string) (*Build, error)

func NewBuild

func NewBuild(app string) Build

func (*Build) Cleanup

func (b *Build) Cleanup() error

func (*Build) ECRLogin

func (b *Build) ECRLogin() (string, error)

func (*Build) ExecuteLocal

func (b *Build) ExecuteLocal(r io.Reader, cache bool, config string, ch chan error)

func (*Build) ExecuteRemote

func (b *Build) ExecuteRemote(repo string, cache bool, config string, ch chan error)

func (*Build) Fail

func (b *Build) Fail(err error)

func (*Build) Image

func (b *Build) Image(process string) string

func (*Build) IsRunning

func (b *Build) IsRunning() bool

Test if another build container is running. This is a temporary workaround since the current Docker Registry does not handle pushing multiple images at the same time. Course grained locking will prevent subtle build errors until a better registry and/or Docker image subsystem is integrated

func (*Build) Save

func (b *Build) Save() error

type Builds

type Builds []Build

func ListBuilds

func ListBuilds(app string) (Builds, error)

type CfsslCertificateBundle

type CfsslCertificateBundle struct {
	Bundle string `json:"bundle"`
}

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 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 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 GetRegistriesAuth

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

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 Instance

type Instance struct {
	Agent     bool      `json:"agent"`
	Cpu       float64   `json:"cpu"`
	Id        string    `json:"id"`
	Ip        string    `json:"ip"`
	Memory    float64   `json:"memory"`
	Processes int       `json:"processes"`
	Status    string    `json:"status"`
	Started   time.Time `json:"started"`
}

func ListInstances

func ListInstances() ([]*Instance, error)

func (*Instance) Docker

func (i *Instance) Docker() (*docker.Client, error)

type InstanceResource

type InstanceResource struct {
	Total int `json:"total"`
	Free  int `json:"free"`
	Used  int `json:"used"`
}

func (InstanceResource) PercentUsed

func (ir InstanceResource) PercentUsed() float64

type Manifest

type Manifest []ManifestEntry

func LoadManifest

func LoadManifest(data string) (Manifest, error)

func (Manifest) BalancerResourceName

func (m Manifest) BalancerResourceName(process string) string

func (Manifest) Balancers

func (m Manifest) Balancers() []ManifestBalancer

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

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      []string                 `yaml:"environment"`
	Exports  map[string]string        `yaml:"-"`
	Image    string                   `yaml:"image"`
	Links    []string                 `yaml:"links"`
	LinkVars map[string]template.HTML `yaml:"-"`
	Ports    []string                 `yaml:"ports"`
	Volumes  []string                 `yaml:"volumes"`
	// contains filtered or unexported fields
}

func (*ManifestEntry) BalancerResourceName

func (me *ManifestEntry) BalancerResourceName() 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) MountableVolumes

func (me ManifestEntry) MountableVolumes() []string

func (ManifestEntry) PortMappings

func (me ManifestEntry) PortMappings() []ManifestPort

func (ManifestEntry) Randoms

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

type ManifestPort

type ManifestPort struct {
	Balancer  string
	Container string
	Public    bool
}

type Metrics

type Metrics struct {
	Cpu    float64
	Memory float64
	Disk   float64
}

func AppMetrics

func AppMetrics(app string) (*Metrics, error)

func InstanceMetrics

func InstanceMetrics(app, process, instance string) (*Metrics, error)

func ProcessMetrics

func ProcessMetrics(app, process string) (*Metrics, error)

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 (*Process) Docker

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

func (*Process) FetchStats

func (p *Process) FetchStats() error

func (*Process) FetchStatsAsync

func (p *Process) FetchStatsAsync(psch chan Process, errch chan error)

func (*Process) Stop

func (p *Process) Stop() error

type Processes

type Processes []Process

func ListOneoffProcesses

func ListOneoffProcesses(app string) (Processes, error)

func ListPendingProcesses

func ListPendingProcesses(app string) (Processes, error)

func ListProcesses

func ListProcesses(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) Cleanup

func (r *Release) Cleanup() error

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

func ListReleases

func ListReleases(app string) (Releases, error)

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 {
	Expiration time.Time `json:"expiration"`
	Domain     string    `json:"domain"`
	Process    string    `json:"process"`
	Port       int       `json:"port"`
	Secure     bool      `json:"secure"`
}

func CreateSSL

func CreateSSL(app, process string, port int, body, key string, chain string, secure bool) (*SSL, error)

func DeleteSSL

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

func UpdateSSL

func UpdateSSL(app, process string, port int, body, key string, chain 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 (*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) 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) LinkPapertrail

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

func (*Service) SubscribeLogs

func (s *Service) SubscribeLogs(output chan []byte, quit chan bool) error

func (*Service) UnlinkPapertrail

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

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 System

type System client.System

func GetSystem

func GetSystem() (*System, error)

func (*System) Save

func (r *System) Save() error

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