Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsErrCode(err error, code string) bool
- func ContainsErrMsg(err error, msg string) bool
- func IteratePages(fn paginatedf) error
- func MarshalDockerrun(body []byte) (*models.Dockerrun, error)
- type ECSBackend
- type ECSDeployManager
- func (this *ECSDeployManager) CreateDeploy(deployName string, body []byte) (*models.Deploy, error)
- func (this *ECSDeployManager) DeleteDeploy(deployID string) error
- func (this *ECSDeployManager) GetDeploy(deployID string) (*models.Deploy, error)
- func (this *ECSDeployManager) ListDeploys() ([]*models.Deploy, error)
- type ECSEnvironmentManager
- func (e *ECSEnvironmentManager) CreateEnvironment(environmentName string, instanceSize string, operatingSystem string, ...) (*models.Environment, error)
- func (e *ECSEnvironmentManager) CreateEnvironmentLink(sourceEnvironmentID, destEnvironmentID string) error
- func (e *ECSEnvironmentManager) DeleteEnvironment(environmentID string) error
- func (e *ECSEnvironmentManager) DeleteEnvironmentLink(sourceEnvironmentID, destEnvironmentID string) error
- func (e *ECSEnvironmentManager) GetEnvironment(environmentID string) (*models.Environment, error)
- func (e *ECSEnvironmentManager) ListEnvironments() ([]id.ECSEnvironmentID, error)
- func (e *ECSEnvironmentManager) UpdateEnvironment(environmentID string, minClusterCount int) (*models.Environment, error)
- type ECSLoadBalancerManager
- func (e *ECSLoadBalancerManager) CreateLoadBalancer(loadBalancerName, environmentID string, isPublic bool, ports []models.Port, ...) (*models.LoadBalancer, error)
- func (e *ECSLoadBalancerManager) DeleteLoadBalancer(loadBalancerID string) error
- func (e *ECSLoadBalancerManager) GetLoadBalancer(loadBalancerID string) (*models.LoadBalancer, error)
- func (e *ECSLoadBalancerManager) ListLoadBalancers() ([]*models.LoadBalancer, error)
- func (e *ECSLoadBalancerManager) UpdateLoadBalancerCrossZone(loadBalancerID string, crossZone bool) (*models.LoadBalancer, error)
- func (e *ECSLoadBalancerManager) UpdateLoadBalancerHealthCheck(loadBalancerID string, healthCheck models.HealthCheck) (*models.LoadBalancer, error)
- func (e *ECSLoadBalancerManager) UpdateLoadBalancerIdleTimeout(loadBalancerID string, idleTimeout int) (*models.LoadBalancer, error)
- func (e *ECSLoadBalancerManager) UpdateLoadBalancerPorts(loadBalancerID string, ports []models.Port) (*models.LoadBalancer, error)
- type ECSResourceManager
- func (r *ECSResourceManager) CalculateNewProvider(environmentID string) (*resource.ResourceProvider, error)
- func (r *ECSResourceManager) GetProviders(environmentID string) ([]*resource.ResourceProvider, error)
- func (r *ECSResourceManager) ScaleTo(environmentID string, scale int, unusedProviders []*resource.ResourceProvider) (int, error)
- type ECSServiceManager
- func (this *ECSServiceManager) CreateService(serviceName, environmentID, deployID, loadBalancerID string) (*models.Service, error)
- func (this *ECSServiceManager) DeleteService(environmentID, serviceID string) error
- func (this *ECSServiceManager) GetEnvironmentServices(environmentID string) ([]*models.Service, error)
- func (this *ECSServiceManager) GetService(environmentID, serviceID string) (*models.Service, error)
- func (this *ECSServiceManager) GetServiceLogs(environmentID, serviceID, start, end string, tail int) ([]*models.LogFile, error)
- func (this *ECSServiceManager) ListServices() ([]id.ECSServiceID, error)
- func (this *ECSServiceManager) ScaleService(environmentID string, serviceID string, count int) (*models.Service, error)
- func (this *ECSServiceManager) UpdateService(environmentID string, serviceID string, deployID string) (*models.Service, error)
- type ECSTaskManager
- func (this *ECSTaskManager) CreateTask(environmentID string, deployID string, overrides []models.ContainerOverride) (string, error)
- func (this *ECSTaskManager) DeleteTask(environmentID, taskARN string) error
- func (this *ECSTaskManager) GetEnvironmentTasks(environmentID string) (map[string]*models.Task, error)
- func (this *ECSTaskManager) GetTask(environmentID, taskARN string) (*models.Task, error)
- func (this *ECSTaskManager) GetTaskLogs(environmentID, taskARN, start, end string, tail int) ([]*models.LogFile, error)
- func (this *ECSTaskManager) ListTasks() ([]string, error)
Constants ¶
View Source
const ( ClusterCapacityReason = "Waiting for cluster capacity to run" StopTaskReason = "Task deleted by user" )
View Source
const MAX_SERVICE_CREATE_RETRIES = 10
View Source
const MAX_TASK_IDS = 100
Variables ¶
View Source
var CreateRenderedDockerrun = func(body []byte) (*models.Dockerrun, error) { dockerrun, err := MarshalDockerrun(body) if err != nil { return nil, err } for _, container := range dockerrun.ContainerDefinitions { if container.LogConfiguration == nil { container.LogConfiguration = &awsecs.LogConfiguration{ LogDriver: stringp("awslogs"), Options: map[string]*string{ "awslogs-group": stringp(config.AWSLogGroupID()), "awslogs-region": stringp(config.AWSRegion()), "awslogs-stream-prefix": stringp("l0"), }, } } } return dockerrun, nil }
View Source
var GetLogs = func(cloudWatchLogs cloudwatchlogs.Provider, taskARNs []*string, start, end string, tail int) ([]*models.LogFile, error) { taskIDCatalog := generateTaskIDCatalog(taskARNs) orderBy := "LastEventTime" logStreams, err := cloudWatchLogs.DescribeLogStreams(config.AWSLogGroupID(), orderBy) if err != nil { return nil, err } logFiles := []*models.LogFile{} for _, logStream := range logStreams { streamNameSplit := strings.Split(*logStream.LogStreamName, "/") if len(streamNameSplit) != 3 { continue } streamTaskID := streamNameSplit[2] if _, ok := taskIDCatalog[streamTaskID]; !ok { continue } logFile := &models.LogFile{ Name: streamNameSplit[1], Lines: []string{}, } logEvents, err := cloudWatchLogs.GetLogEvents( config.AWSLogGroupID(), *logStream.LogStreamName, start, end, int64(tail)) if err != nil { return nil, err } for _, logEvent := range logEvents { logFile.Lines = append(logFile.Lines, *logEvent.Message) } logFiles = append(logFiles, logFile) } return logFiles, nil }
Functions ¶
func ContainsErrCode ¶
func ContainsErrMsg ¶
func IteratePages ¶
func IteratePages(fn paginatedf) error
Types ¶
type ECSBackend ¶
type ECSBackend struct { *ECSEnvironmentManager *ECSServiceManager *ECSDeployManager *ECSLoadBalancerManager *ECSTaskManager }
todo: this is an awkward design pattern - we don't need to split the ECSBackend object into many parts with self-references to 'this.Backend' we should just make the backend one single object with many functions
func NewBackend ¶
type ECSDeployManager ¶
func NewECSDeployManager ¶
func NewECSDeployManager(ecsprovider ecs.Provider) *ECSDeployManager
func (*ECSDeployManager) CreateDeploy ¶
func (*ECSDeployManager) DeleteDeploy ¶
func (this *ECSDeployManager) DeleteDeploy(deployID string) error
func (*ECSDeployManager) GetDeploy ¶
func (this *ECSDeployManager) GetDeploy(deployID string) (*models.Deploy, error)
func (*ECSDeployManager) ListDeploys ¶
func (this *ECSDeployManager) ListDeploys() ([]*models.Deploy, error)
type ECSEnvironmentManager ¶
type ECSEnvironmentManager struct { ECS ecs.Provider EC2 ec2.Provider AutoScaling autoscaling.Provider Backend backend.Backend Clock waitutils.Clock }
func NewECSEnvironmentManager ¶
func NewECSEnvironmentManager( ecsprovider ecs.Provider, ec2 ec2.Provider, asg autoscaling.Provider, backend backend.Backend) *ECSEnvironmentManager
func (*ECSEnvironmentManager) CreateEnvironment ¶
func (e *ECSEnvironmentManager) CreateEnvironment( environmentName string, instanceSize string, operatingSystem string, amiID string, minClusterCount int, userDataTemplate []byte, ) (*models.Environment, error)
func (*ECSEnvironmentManager) CreateEnvironmentLink ¶
func (e *ECSEnvironmentManager) CreateEnvironmentLink(sourceEnvironmentID, destEnvironmentID string) error
func (*ECSEnvironmentManager) DeleteEnvironment ¶
func (e *ECSEnvironmentManager) DeleteEnvironment(environmentID string) error
func (*ECSEnvironmentManager) DeleteEnvironmentLink ¶
func (e *ECSEnvironmentManager) DeleteEnvironmentLink(sourceEnvironmentID, destEnvironmentID string) error
func (*ECSEnvironmentManager) GetEnvironment ¶
func (e *ECSEnvironmentManager) GetEnvironment(environmentID string) (*models.Environment, error)
func (*ECSEnvironmentManager) ListEnvironments ¶
func (e *ECSEnvironmentManager) ListEnvironments() ([]id.ECSEnvironmentID, error)
func (*ECSEnvironmentManager) UpdateEnvironment ¶
func (e *ECSEnvironmentManager) UpdateEnvironment(environmentID string, minClusterCount int) (*models.Environment, error)
type ECSLoadBalancerManager ¶
type ECSLoadBalancerManager struct { EC2 ec2.Provider ELB elb.Provider IAM iam.Provider Backend backend.Backend Clock waitutils.Clock }
func (*ECSLoadBalancerManager) CreateLoadBalancer ¶
func (e *ECSLoadBalancerManager) CreateLoadBalancer( loadBalancerName, environmentID string, isPublic bool, ports []models.Port, healthCheck models.HealthCheck, idleTimeout int, crossZone bool, ) (*models.LoadBalancer, error)
func (*ECSLoadBalancerManager) DeleteLoadBalancer ¶
func (e *ECSLoadBalancerManager) DeleteLoadBalancer(loadBalancerID string) error
func (*ECSLoadBalancerManager) GetLoadBalancer ¶
func (e *ECSLoadBalancerManager) GetLoadBalancer(loadBalancerID string) (*models.LoadBalancer, error)
func (*ECSLoadBalancerManager) ListLoadBalancers ¶
func (e *ECSLoadBalancerManager) ListLoadBalancers() ([]*models.LoadBalancer, error)
func (*ECSLoadBalancerManager) UpdateLoadBalancerCrossZone ¶ added in v0.11.0
func (e *ECSLoadBalancerManager) UpdateLoadBalancerCrossZone(loadBalancerID string, crossZone bool) (*models.LoadBalancer, error)
func (*ECSLoadBalancerManager) UpdateLoadBalancerHealthCheck ¶
func (e *ECSLoadBalancerManager) UpdateLoadBalancerHealthCheck(loadBalancerID string, healthCheck models.HealthCheck) (*models.LoadBalancer, error)
func (*ECSLoadBalancerManager) UpdateLoadBalancerIdleTimeout ¶ added in v0.10.7
func (e *ECSLoadBalancerManager) UpdateLoadBalancerIdleTimeout(loadBalancerID string, idleTimeout int) (*models.LoadBalancer, error)
func (*ECSLoadBalancerManager) UpdateLoadBalancerPorts ¶
func (e *ECSLoadBalancerManager) UpdateLoadBalancerPorts(loadBalancerID string, ports []models.Port) (*models.LoadBalancer, error)
type ECSResourceManager ¶
type ECSResourceManager struct { ECS ecs.Provider Autoscaling autoscaling.Provider // contains filtered or unexported fields }
func NewECSResourceManager ¶
func NewECSResourceManager(e ecs.Provider, a autoscaling.Provider) *ECSResourceManager
func (*ECSResourceManager) CalculateNewProvider ¶
func (r *ECSResourceManager) CalculateNewProvider(environmentID string) (*resource.ResourceProvider, error)
func (*ECSResourceManager) GetProviders ¶
func (r *ECSResourceManager) GetProviders(environmentID string) ([]*resource.ResourceProvider, error)
func (*ECSResourceManager) ScaleTo ¶
func (r *ECSResourceManager) ScaleTo(environmentID string, scale int, unusedProviders []*resource.ResourceProvider) (int, error)
type ECSServiceManager ¶
type ECSServiceManager struct { ECS ecs.Provider EC2 ec2.Provider CloudWatchLogs cloudwatchlogs.Provider Backend backend.Backend Clock waitutils.Clock }
func NewECSServiceManager ¶
func NewECSServiceManager( ecsProvider ecs.Provider, ec2Provider ec2.Provider, cloudWatchLogsProvider cloudwatchlogs.Provider, backend backend.Backend, ) *ECSServiceManager
func (*ECSServiceManager) CreateService ¶
func (this *ECSServiceManager) CreateService( serviceName, environmentID, deployID, loadBalancerID string, ) (*models.Service, error)
func (*ECSServiceManager) DeleteService ¶
func (this *ECSServiceManager) DeleteService(environmentID, serviceID string) error
func (*ECSServiceManager) GetEnvironmentServices ¶ added in v0.10.4
func (this *ECSServiceManager) GetEnvironmentServices(environmentID string) ([]*models.Service, error)
func (*ECSServiceManager) GetService ¶
func (this *ECSServiceManager) GetService(environmentID, serviceID string) (*models.Service, error)
func (*ECSServiceManager) GetServiceLogs ¶
func (*ECSServiceManager) ListServices ¶
func (this *ECSServiceManager) ListServices() ([]id.ECSServiceID, error)
func (*ECSServiceManager) ScaleService ¶
func (*ECSServiceManager) UpdateService ¶
type ECSTaskManager ¶
type ECSTaskManager struct { ECS ecs.Provider CloudWatchLogs cloudwatchlogs.Provider Backend backend.Backend }
func NewECSTaskManager ¶
func NewECSTaskManager( ecsProvider ecs.Provider, cloudWatchLogsProvider cloudwatchlogs.Provider, backend backend.Backend, ) *ECSTaskManager
func (*ECSTaskManager) CreateTask ¶
func (this *ECSTaskManager) CreateTask( environmentID string, deployID string, overrides []models.ContainerOverride, ) (string, error)
func (*ECSTaskManager) DeleteTask ¶
func (this *ECSTaskManager) DeleteTask(environmentID, taskARN string) error
func (*ECSTaskManager) GetEnvironmentTasks ¶ added in v0.10.4
func (*ECSTaskManager) GetTask ¶
func (this *ECSTaskManager) GetTask(environmentID, taskARN string) (*models.Task, error)
func (*ECSTaskManager) GetTaskLogs ¶
func (*ECSTaskManager) ListTasks ¶
func (this *ECSTaskManager) ListTasks() ([]string, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.