target

package
v0.6.18 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterName

func ClusterName(input string) (string, error)

ClusterName returns the short cluster name from a short name or ECS ARN.

func EligibleContainers

func EligibleContainers(task types.Task) []types.Container

EligibleContainers returns the containers ready for ECS Exec or port forwarding.

func IsEligibleTask

func IsEligibleTask(task types.Task) bool

IsEligibleTask reports whether a task contains at least one ready container.

func TaskID

func TaskID(input string) (string, error)

TaskID returns the task ID from a short or long ECS task resource or ARN.

Types

type Clock

type Clock interface {
	Now() time.Time
	Sleep(context.Context, time.Duration) error
}

Clock is the time boundary used while waiting for eligible ECS tasks.

func RealClock

func RealClock() Clock

RealClock returns a clock backed by the system clock and context-aware timers.

type ECSAPI

type ECSAPI interface {
	ListClusters(context.Context, *ecs.ListClustersInput, ...func(*ecs.Options)) (*ecs.ListClustersOutput, error)
	ListTasks(context.Context, *ecs.ListTasksInput, ...func(*ecs.Options)) (*ecs.ListTasksOutput, error)
	DescribeTasks(context.Context, *ecs.DescribeTasksInput, ...func(*ecs.Options)) (*ecs.DescribeTasksOutput, error)
}

ECSAPI is the subset of the ECS client used to resolve executable targets.

type Resolved

type Resolved struct {
	ECSCluster    string
	ClusterName   string
	Task          types.Task
	TaskARN       string
	TaskID        string
	Container     types.Container
	ContainerName string
	RuntimeID     string
}

Resolved is a fully validated ECS target ready for Session Manager.

func (Resolved) SSMTarget

func (r Resolved) SSMTarget() string

SSMTarget returns the ECS target identifier expected by Session Manager.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver retrieves ECS resources that are eligible for a target operation.

func NewResolver

func NewResolver(client ECSAPI) *Resolver

NewResolver creates a Resolver backed by client.

func (*Resolver) Clusters

func (r *Resolver) Clusters(ctx context.Context) ([]string, error)

Clusters returns every ECS cluster ARN in API response order.

func (*Resolver) EligibleTasks

func (r *Resolver) EligibleTasks(ctx context.Context, cluster, serviceName string) ([]types.Task, error)

EligibleTasks returns every task in cluster that is ready for an ECS target operation. When serviceName is non-empty, only that service is queried.

func (*Resolver) WaitForEligibleTasks

func (r *Resolver) WaitForEligibleTasks(
	ctx context.Context,
	cluster string,
	service string,
	maxWait time.Duration,
	clock Clock,
) ([]types.Task, error)

WaitForEligibleTasks polls until the selected cluster contains at least one task ready for an ECS target operation or maxWait expires.

Jump to

Keyboard shortcuts

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