 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
const ( Cluster = "ecs_cluster" CreatedAt = "ecs_created_at" TaskFamily = "ecs_task_family" ServiceDesiredCount = "ecs_service_desired_count" ServiceRunningCount = "ecs_service_running_count" ScaleUp = "ecs_scale_up" ScaleDown = "ecs_scale_down" )
TaskFamily is the key that stores the task family of an ECS Task
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EcsClient ¶
type EcsClient interface {
	// Returns a EcsInfo struct containing data needed for a report.
	GetInfo([]string) EcsInfo
	// Scales a service up or down by amount
	ScaleService(string, int) error
}
    EcsClient is a wrapper around an AWS client that makes all the needed calls and just exposes the final results. We create an interface so we can mock for testing.
type EcsInfo ¶
type EcsInfo struct {
	Tasks          map[string]EcsTask
	Services       map[string]EcsService
	TaskServiceMap map[string]string
}
    EcsInfo is exported for test
type EcsService ¶
type EcsService struct {
	ServiceName string
	// The following values may be stale in a cached copy
	DeploymentIDs     []string
	DesiredCount      int64
	PendingCount      int64
	RunningCount      int64
	TaskDefinitionARN string
}
    EcsService describes the parts of ECS services we care about. Services are highly mutable and so we can only cache them on a best-effort basis. We have to refresh referenced (ie. has an associated task) services each report but we avoid re-listing services unless we can't find a service for a task. Exported for test.
type EcsTask ¶
type EcsTask struct {
	TaskARN           string
	CreatedAt         time.Time
	TaskDefinitionARN string
	// These started fields are immutable once set, and guaranteed to be set once the task is running,
	// which we know it is because otherwise we wouldn't be looking at it.
	StartedAt time.Time
	StartedBy string // tag or deployment id
}
    EcsTask describes the parts of ECS tasks we care about. Since we're caching tasks heavily, we ensure no mistakes by casting into a structure that only contains immutable attributes of the resource. Exported for test.
type Reporter ¶
type Reporter struct {
	ClientsByCluster map[string]EcsClient // Exported for test
	// contains filtered or unexported fields
}
    Reporter implements Tagger, Reporter
       Source Files
      ¶
      Source Files
      ¶
    
- client.go
- reporter.go