Documentation
¶
Overview ¶
Package cluster provides functionality for managing AWS ECS clusters, including service management, task definitions, and container operations.
Index ¶
- Variables
- type AutoscalingOptions
- type Cluster
- func (c *Cluster) AggregateLogGroupARNs(ctx context.Context, services []ecstypes.Service) ([]string, error)
- func (c *Cluster) AttachPortForwardingSession(ctx context.Context, taskARN arn.ARN, containerName string, host string, ...) error
- func (c *Cluster) AttachShellSession(ctx context.Context, taskARN arn.ARN, containerName string, command []string) error
- func (c *Cluster) Autoscale(ctx context.Context, serviceName string, options *AutoscalingOptions) error
- func (c *Cluster) Deploy(ctx context.Context, serviceName string, taskDefinitionARN arn.ARN) error
- func (c *Cluster) DescribeAllServices(ctx context.Context) ([]ecstypes.Service, error)
- func (c *Cluster) DescribeService(ctx context.Context, serviceName string) (*ecstypes.Service, error)
- func (c *Cluster) DescribeServiceTaskDefinitions(ctx context.Context) ([]ServiceTaskDefinition, error)
- func (c *Cluster) DescribeTaskDefinition(ctx context.Context, family string) (*ecs.DescribeTaskDefinitionOutput, error)
- func (c *Cluster) GetFirstTaskARN(ctx context.Context, serviceName string) (arn.ARN, error)
- func (c *Cluster) ReplaceTaskDefinitionTag(ctx context.Context, taskDefinitionARN arn.ARN, ...) (arn.ARN, error)
- func (c *Cluster) Restart(ctx context.Context, serviceName string) error
- func (c *Cluster) RunConsole(ctx context.Context, serviceName string, containerName string) (arn.ARN, error)
- func (c *Cluster) Scale(ctx context.Context, serviceName string, options *ScaleOptions) error
- func (c *Cluster) Start(ctx context.Context, serviceName string) error
- func (c *Cluster) Stop(ctx context.Context, serviceName string) error
- type ScaleOptions
- type ServiceTaskDefinition
Constants ¶
This section is empty.
Variables ¶
var ( // ErrServiceNotFound is returned when a requested service cannot be found in the cluster. ErrServiceNotFound = errors.New("service not found") // ErrContainerNotFound is returned when a requested container cannot be found in a task. ErrContainerNotFound = errors.New("container not found") // ErrTaskNotFound is returned when a requested task cannot be found in the cluster. ErrTaskNotFound = errors.New("task not found") // ErrNoTasks is returned when there are no running tasks in the service. ErrNoTasks = errors.New("no tasks running") // ErrInvalidImage is returned when the image format is not valid. ErrInvalidImage = errors.New("invalid image format") // ErrInvalidTaskDefinition is returned when the task definition ARN format is not valid. ErrInvalidTaskDefinition = errors.New("invalid task definition ARN") // ErrInvalidOption is returned when an invalid option is provided. ErrInvalidOption = errors.New("invalid option") )
Functions ¶
This section is empty.
Types ¶
type AutoscalingOptions ¶ added in v0.2.0
AutoscalingOptions contains options for autoscaling a service.
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster represents an AWS ECS cluster with methods for managing services and tasks.
func NewCluster ¶
NewCluster creates a new Cluster instance with the provided AWS configuration and cluster name.
func (*Cluster) AggregateLogGroupARNs ¶ added in v0.3.0
func (c *Cluster) AggregateLogGroupARNs(ctx context.Context, services []ecstypes.Service) ([]string, error)
AggregateLogGroupARNs aggregates the log group ARNs from the task definitions of the provided services.
func (*Cluster) AttachPortForwardingSession ¶ added in v0.2.0
func (c *Cluster) AttachPortForwardingSession(ctx context.Context, taskARN arn.ARN, containerName string, host string, portNumber int, localPortNumber int) error
AttachPortForwardingSession attaches to a running container and forwards a port to the local machine.
func (*Cluster) AttachShellSession ¶ added in v0.2.0
func (c *Cluster) AttachShellSession(ctx context.Context, taskARN arn.ARN, containerName string, command []string) error
AttachShellSession attaches to a running container and executes a command in a shell session.
func (*Cluster) Autoscale ¶ added in v0.2.0
func (c *Cluster) Autoscale(ctx context.Context, serviceName string, options *AutoscalingOptions) error
Autoscale autoscales a service by registering a scalable target with the specified options.
func (*Cluster) DescribeAllServices ¶
DescribeAllServices returns a list of all services in the cluster.
func (*Cluster) DescribeService ¶ added in v0.2.0
func (c *Cluster) DescribeService(ctx context.Context, serviceName string) (*ecstypes.Service, error)
DescribeService retrieves the details of a specific service in the cluster.
func (*Cluster) DescribeServiceTaskDefinitions ¶
func (c *Cluster) DescribeServiceTaskDefinitions(ctx context.Context) ([]ServiceTaskDefinition, error)
DescribeServiceTaskDefinitions returns all services and their associated task definitions.
func (*Cluster) DescribeTaskDefinition ¶ added in v0.2.0
func (c *Cluster) DescribeTaskDefinition(ctx context.Context, family string) (*ecs.DescribeTaskDefinitionOutput, error)
DescribeTaskDefinition retrieves the task definition for a given family.
func (*Cluster) GetFirstTaskARN ¶
GetFirstTaskARN returns the ARN of the first running task for a service.
func (*Cluster) ReplaceTaskDefinitionTag ¶
func (c *Cluster) ReplaceTaskDefinitionTag(ctx context.Context, taskDefinitionARN arn.ARN, replacer func(repo, image, tag string) string) (arn.ARN, error)
ReplaceTaskDefinitionTag updates the image tag in a task definition.
func (*Cluster) RunConsole ¶
func (c *Cluster) RunConsole(ctx context.Context, serviceName string, containerName string) (arn.ARN, error)
RunConsole starts a new task with an interactive console session.
func (*Cluster) Scale ¶ added in v0.2.0
Scale scales a service to the specified size. If min or max is specified, it will scale to the minimum or maximum capacity of the service.
type ScaleOptions ¶ added in v0.2.0
ScaleOptions contains options for scaling a service.
type ServiceTaskDefinition ¶
type ServiceTaskDefinition struct {
Service ecstypes.Service
TaskDefinition ecstypes.TaskDefinition
}
ServiceTaskDefinition represents a service and its associated task definition.