models

package
v0.0.0-...-218c583 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2017 License: Apache-2.0, Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CustomTopic               = os.Getenv("CUSTOM_TOPIC")
	CloudformationEventsTopic = os.Getenv("CLOUDFORMATION_EVENTS_TOPIC")

	StatusCodePrefix = client.StatusCodePrefix
)
View Source
var DescribeStacksCache = map[string]DescribeStacksResult{}
View Source
var DescribeStacksCacheTTL = 5 * time.Second
View Source
var DescribeStacksMutex = &sync.Mutex{}
View Source
var Logger = logger.New("ns=api.models")

Logger is a package-wide logger

View Source
var ManifestRandomPorts = true

set to false when testing for deterministic ports

View Source
var NotificationTopic = os.Getenv("NOTIFICATION_TOPIC")

NotificationTopic is the SNS topic for notifications

View Source
var PauseNotifications = false

PauseNotifications turns off notifications globally

View Source
var SortableTime = "20060102.150405.000000000"
View Source
var TestProvider = &provider.MockProvider{}

TestProvider is a global test provider

Functions

func ACM

func ACM() *acm.ACM

func AppDockerLogin

func AppDockerLogin(app structs.App) (string, error)

Log into the appropriate registry for the given app

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 CloudFormation

func CloudFormation() *cloudformation.CloudFormation

func CloudWatchLogs

func CloudWatchLogs() *cloudwatchlogs.CloudWatchLogs

func DashName

func DashName(name string) string

func DescribeContainerInstances

func DescribeContainerInstances() (*ecs.DescribeContainerInstancesOutput, error)

DescribeContainerInstances lists and describes all the ECS instances. It handles pagination for clusters > 100 instances.

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

func ParseEnvLine(line string) (string, string)

ParseEnvLine returns a valid key, value pair or empty strings

func PrettyJSON

func PrettyJSON(raw string) (string, error)

PrettyJSON returns JSON string in a human-readable format

func Provider

func Provider() provider.Provider

Provider returns the appropriate provider interface based on the env

func PullAppImages

func PullAppImages()

func PutEnvironment

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

PutEnvironment creates a new release with a given Environment.

func PutRackSettings

func PutRackSettings(env Environment) error

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 Test

func Test(t *testing.T, fn func())

Test provides a wrapping helper for running model tests

func UpperName

func UpperName(name string) string

Types

type Agent

type Agent struct {
	Service *manifest.Service
	App     *App
}

Agent represents a Service which runs exactly once on every ECS agent

func (*Agent) LongName

func (d *Agent) LongName() string

LongName returns the name of the Agent Service in [stack name]-[service name]-hash format

func (*Agent) ShortName

func (d *Agent) ShortName() string

ShortName returns the name of the Agent Service, sans any invalid characters

type Agents

type Agents []Agent

Agents is a wrapper for sorting

func (Agents) Len

func (a Agents) Len() int

func (Agents) Less

func (a Agents) Less(i, j int) bool

func (Agents) Swap

func (a Agents) Swap(i, j int)

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 deprecated

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

Deprecated: Provider.AppGet() should be used instead

func GetAppBound

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

func GetAppUnbound

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

func (App) AgentFunctionCode

func (a App) AgentFunctionCode() map[string]template.HTML

AgentFunctionCode returns the Node.js code used by the AgentFunction lambda

func (App) Agents

func (a App) Agents(m manifest.Manifest) []Agent

Agents returns any Agent Services defined in the given Manifest

func (*App) Create

func (a *App) Create() error

func (App) CronJobs

func (a App) CronJobs(m manifest.Manifest) []CronJob

func (*App) Delete

func (a *App) Delete() error

func (*App) ForkRelease

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

func (*App) Formation

func (a *App) Formation(m manifest.Manifest) (string, error)

func (*App) IsBound

func (a *App) IsBound() bool

func (*App) Resources

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

func (*App) StackName

func (a *App) StackName() string

StackName returns the app's stack if the app is bound. Otherwise returns the short name.

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"`
	Service  *manifest.Service
	App      *App
}

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 CronJobs

type CronJobs []CronJob

CronJobs is a wrapper for sorting

func (CronJobs) Len

func (a CronJobs) Len() int

func (CronJobs) Less

func (a CronJobs) Less(i, j int) bool

func (CronJobs) Swap

func (a CronJobs) Swap(i, j int)

type DescribeStacksResult

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

type Environment

type Environment map[string]string

func GetEnvironment

func GetEnvironment(app string) (Environment, error)

GetEnvironment retrieves an app's current Environment.

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, error)

LoadEnvironment loads input into an Environment struct.

func (Environment) Raw

func (e Environment) Raw() string

func (Environment) SortedNames

func (e Environment) SortedNames() []string

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 Template

type Template struct {
	Parameters map[string]TemplateParameter
}

type TemplateParameter

type TemplateParameter struct {
	Default     string
	Description string
	Type        string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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