ecs

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package ecs provides a client to retrieve Copilot ECS information.

Package ecs provides a client to retrieve Copilot ECS information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	StepFuncClient stepFunctionsClient
	// contains filtered or unexported fields
}

Client retrieves Copilot information from ECS endpoint.

func New

func New(sess *session.Session) *Client

New creates a new Client.

func (Client) ClusterARN added in v1.1.0

func (c Client) ClusterARN(app, env string) (string, error)

ClusterARN returns the ARN of the cluster in an environment.

func (Client) DescribeService added in v1.1.0

func (c Client) DescribeService(app, env, svc string) (*ServiceDesc, error)

DescribeService returns the description of an ECS service given Copilot service info.

func (Client) ForceUpdateService added in v1.10.0

func (c Client) ForceUpdateService(app, env, svc string) error

ForceUpdateService forces a new update for an ECS service given Copilot service info.

func (Client) HasNonZeroExitCode added in v1.20.0

func (c Client) HasNonZeroExitCode(taskARNs []string, cluster string) error

HasNonZeroExitCode returns an error if at least one of the tasks exited with a non-zero exit code. It assumes that all tasks are built on the same task definition.

func (Client) LastUpdatedAt added in v1.14.0

func (c Client) LastUpdatedAt(app, env, svc string) (time.Time, error)

LastUpdatedAt returns the last updated time of the ECS service.

func (Client) ListActiveAppEnvTasks added in v1.1.0

func (c Client) ListActiveAppEnvTasks(opts ListActiveAppEnvTasksOpts) ([]*ecs.Task, error)

ListActiveAppEnvTasks returns the active Copilot tasks in the environment of an application.

func (Client) ListActiveDefaultClusterTasks added in v1.1.0

func (c Client) ListActiveDefaultClusterTasks(filter ListTasksFilter) ([]*ecs.Task, error)

ListActiveDefaultClusterTasks returns the active Copilot tasks in the default cluster.

func (Client) NetworkConfiguration added in v1.6.0

func (c Client) NetworkConfiguration(app, env, svc string) (*ecs.NetworkConfiguration, error)

NetworkConfiguration returns the network configuration of the service.

func (Client) NetworkConfigurationForJob added in v1.7.0

func (c Client) NetworkConfigurationForJob(app, env, job string) (*ecs.NetworkConfiguration, error)

NetworkConfigurationForJob returns the network configuration of the job.

func (Client) Service added in v1.24.0

func (c Client) Service(app, env, svc string) (*ecs.Service, error)

Service returns an ECS service given Copilot service info.

func (Client) ServiceConnectServices added in v1.32.0

func (c Client) ServiceConnectServices(app, env, svc string) ([]*ecs.Service, error)

ServiceConnectServices returns a list of services that are in the same service connect namespace as the given service, except for itself.

func (Client) StopDefaultClusterTasks added in v1.2.0

func (c Client) StopDefaultClusterTasks(familyName string) error

StopDefaultClusterTasks stops all copilot tasks from the given family in the default cluster.

func (Client) StopOneOffTasks added in v1.2.0

func (c Client) StopOneOffTasks(app, env, family string) error

StopOneOffTasks stops all one-off tasks in the given application and environment with the family name.

func (Client) StopWorkloadTasks added in v1.2.0

func (c Client) StopWorkloadTasks(app, env, workload string) error

StopWorkloadTasks stops all tasks in the given application, enviornment, and workload.

func (Client) TaskDefinition added in v1.6.0

func (c Client) TaskDefinition(app, env, svc string) (*ecs.TaskDefinition, error)

TaskDefinition returns the task definition of the service.

type ECSServiceDescriber added in v1.7.0

type ECSServiceDescriber interface {
	Service(clusterName, serviceName string) (*awsecs.Service, error)
	TaskDefinition(taskDefName string) (*awsecs.TaskDefinition, error)
	NetworkConfiguration(cluster, serviceName string) (*awsecs.NetworkConfiguration, error)
}

ECSServiceDescriber provides information on an ECS service.

type EnvVar added in v1.29.1

type EnvVar struct {
	Name  string
	Value string
}

EnvVar contains the value of an environment variable

type ErrExitCode added in v1.20.0

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

ErrExitCode builds custom non-zero exit code error

func (*ErrExitCode) Error added in v1.20.0

func (e *ErrExitCode) Error() string

func (*ErrExitCode) ExitCode added in v1.20.0

func (e *ErrExitCode) ExitCode() int

ExitCode returns the OS exit code configured for this error.

type ErrMultipleContainersInTaskDef added in v1.7.0

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

ErrMultipleContainersInTaskDef is returned when multiple containers are configured in a task definition.

func (*ErrMultipleContainersInTaskDef) Error added in v1.7.0

type JobDescriber added in v1.7.0

type JobDescriber interface {
	TaskDefinition(app, env, job string) (*awsecs.TaskDefinition, error)
	NetworkConfigurationForJob(app, env, job string) (*awsecs.NetworkConfiguration, error)
	ClusterARN(app, env string) (string, error)
}

JobDescriber provides information on a Copilot job.

type ListActiveAppEnvTasksOpts added in v1.1.0

type ListActiveAppEnvTasksOpts struct {
	App string
	Env string
	ListTasksFilter
}

ListActiveAppEnvTasksOpts contains the parameters for ListActiveAppEnvTasks.

type ListTasksFilter added in v1.1.0

type ListTasksFilter struct {
	TaskGroup   string // Returns only tasks with the given TaskGroup name.
	TaskID      string // Returns only tasks with the given ID.
	CopilotOnly bool   // Returns only tasks with the `copilot-task` tag.
}

ListTasksFilter contains the filtering parameters for listing Copilot tasks.

type NetworkConfiguration added in v1.7.0

type NetworkConfiguration ecs.NetworkConfiguration

NetworkConfiguration wraps an ecs.NetworkConfiguration struct.

func (*NetworkConfiguration) UnmarshalJSON added in v1.7.0

func (n *NetworkConfiguration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom logic to unmarshal only the network configuration from a state machine definition. Example state machine definition:

 "Version": "1.0",
 "Comment": "Run AWS Fargate task",
 "StartAt": "Run Fargate Task",
 "States": {
   "Run Fargate Task": {
	 "Type": "Task",
	 "Resource": "arn:aws:states:::ecs:runTask.sync",
	 "Parameters": {
	   "LaunchType": "FARGATE",
	   "PlatformVersion": "1.4.0",
	   "Cluster": "cluster",
	   "TaskDefinition": "def",
	   "PropagateTags": "TASK_DEFINITION",
	   "Group.$": "$$.Execution.Name",
	   "NetworkConfiguration": {
		 "AwsvpcConfiguration": {
		   "Subnets": ["sbn-1", "sbn-2"],
		   "AssignPublicIp": "ENABLED",
		   "SecurityGroups": ["sg-1", "sg-2"]
		 }
	   }
	 },
	 "End": true
   }

type RunTaskRequest added in v1.7.0

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

RunTaskRequest contains information to generate a task run command.

func RunTaskRequestFromECSService added in v1.7.0

func RunTaskRequestFromECSService(client ECSServiceDescriber, cluster, service string) (*RunTaskRequest, error)

RunTaskRequestFromECSService populates a RunTaskRequest with information from an ECS service.

func RunTaskRequestFromJob added in v1.7.0

func RunTaskRequestFromJob(client JobDescriber, app, env, job string) (*RunTaskRequest, error)

RunTaskRequestFromJob populates a RunTaskRequest with information from a Copilot job.

func RunTaskRequestFromService added in v1.7.0

func RunTaskRequestFromService(client ServiceDescriber, app, env, svc string) (*RunTaskRequest, error)

RunTaskRequestFromService populates a RunTaskRequest with information from a Copilot service.

func (RunTaskRequest) CLIString added in v1.7.0

func (r RunTaskRequest) CLIString() (string, error)

CLIString stringifies a RunTaskRequest.

type ServiceDesc added in v1.1.0

type ServiceDesc struct {
	Name         string
	ClusterName  string
	Tasks        []*ecs.Task // Tasks is a list of tasks with DesiredStatus being RUNNING.
	StoppedTasks []*ecs.Task
}

ServiceDesc contains the description of an ECS service.

type ServiceDescriber added in v1.7.0

type ServiceDescriber interface {
	TaskDefinition(app, env, svc string) (*awsecs.TaskDefinition, error)
	NetworkConfiguration(app, env, svc string) (*awsecs.NetworkConfiguration, error)
	ClusterARN(app, env string) (string, error)
}

ServiceDescriber provides information on a Copilot service.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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