cluster

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package cluster provides functionality for managing AWS ECS clusters, including service management, task definitions, and container operations.

Index

Constants

This section is empty.

Variables

View Source
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")
)

Functions

This section is empty.

Types

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

func NewCluster(awsCfg aws.Config, clusterName string, logger log.T) *Cluster

NewCluster creates a new Cluster instance with the provided AWS configuration and cluster name.

func (*Cluster) Attach

func (c *Cluster) Attach(ctx context.Context, taskARN arn.ARN, containerName string, command []string) error

Attach attaches to a running container and executes a command.

func (*Cluster) Deploy

func (c *Cluster) Deploy(ctx context.Context, serviceName string, taskDefinitionARN arn.ARN) error

Deploy updates a service with a new task definition.

func (*Cluster) DescribeAllServices

func (c *Cluster) DescribeAllServices(ctx context.Context) ([]types.Service, error)

DescribeAllServices returns a list of all services 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) GetFirstTaskARN

func (c *Cluster) GetFirstTaskARN(ctx context.Context, serviceName string) (arn.ARN, error)

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.

type ServiceTaskDefinition

type ServiceTaskDefinition struct {
	Service        types.Service
	TaskDefinition types.TaskDefinition
}

ServiceTaskDefinition represents a service and its associated task definition.

Jump to

Keyboard shortcuts

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