task

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package task provides support for running Amazon ECS tasks.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ValidCFNPlatforms are valid docker platforms for running ECS tasks.
	ValidCFNPlatforms = []string{
		dockerengine.PlatformString(osWindowsServer2019Core, archX86),
		dockerengine.PlatformString(osWindowsServer2019Full, archX86),
		dockerengine.PlatformString(osWindowsServer2022Core, archX86),
		dockerengine.PlatformString(osWindowsServer2022Full, archX86),
		dockerengine.PlatformString(osLinux, archX86),
		dockerengine.PlatformString(osLinux, archARM64)}
)

Functions

func IsValidWindowsOS added in v1.12.0

func IsValidWindowsOS(os string) bool

IsValidWindowsOS determines if the OS value is an accepted CFN Windows value.

Types

type ClusterGetter added in v0.7.0

type ClusterGetter interface {
	ClusterARN(app, env string) (string, error)
}

ClusterGetter wraps the method of getting a cluster ARN.

type ConfigRunner added in v1.6.0

type ConfigRunner struct {
	// Count of the tasks to be launched.
	Count int
	// Group Name of the tasks that use the same task definition.
	GroupName string

	// The ARN of the cluster to run the task.
	Cluster string

	// Network configuration
	Subnets        []string
	SecurityGroups []string

	// Interfaces to interact with dependencies. Must not be nil.
	ClusterGetter DefaultClusterGetter
	Starter       Runner

	// Must not be nil if using default subnets.
	VPCGetter VPCGetter

	// Figures non-zero exit code of the task.
	NonZeroExitCodeGetter NonZeroExitCodeGetter

	// Platform configuration
	OS string
}

ConfigRunner runs an Amazon ECS task in the subnets, security groups, and cluster. It uses the default subnets and the default cluster if the corresponding field is empty.

func (*ConfigRunner) CheckNonZeroExitCode added in v1.20.0

func (r *ConfigRunner) CheckNonZeroExitCode(tasks []*Task) error

CheckNonZeroExitCode returns the status of the containers part of the given tasks.

func (*ConfigRunner) Run added in v1.6.0

func (r *ConfigRunner) Run() ([]*Task, error)

Run runs tasks given subnets, security groups and the cluster, and returns the tasks. If subnets are not provided, it uses the default subnets. If cluster is not provided, it uses the default cluster.

type DefaultClusterGetter

type DefaultClusterGetter interface {
	DefaultCluster() (string, error)
}

DefaultClusterGetter wraps the method of getting a default cluster ARN.

type EnvRunner

type EnvRunner struct {
	// Count of the tasks to be launched.
	Count int
	// Group Name of the tasks that use the same task definition.
	GroupName string

	// App and Env in which the tasks will be launched.
	App string
	Env string

	// Extra security groups to use.
	SecurityGroups []string

	// Platform configuration.
	OS string

	// Interfaces to interact with dependencies. Must not be nil.
	VPCGetter            VPCGetter
	ClusterGetter        ClusterGetter
	Starter              Runner
	EnvironmentDescriber environmentDescriber

	// Figures non-zero exit code of the task
	NonZeroExitCodeGetter NonZeroExitCodeGetter
}

EnvRunner can run an Amazon ECS task in the VPC and the cluster of an environment.

func (*EnvRunner) CheckNonZeroExitCode added in v1.20.0

func (r *EnvRunner) CheckNonZeroExitCode(tasks []*Task) error

CheckNonZeroExitCode returns the status of the containers part of the given tasks.

func (*EnvRunner) Run

func (r *EnvRunner) Run() ([]*Task, error)

Run runs tasks in the environment of the application, and returns the tasks.

type NonZeroExitCodeGetter added in v1.20.0

type NonZeroExitCodeGetter interface {
	HasNonZeroExitCode([]string, string) error
}

NonZeroExitCodeGetter wraps the method of getting a non-zero exit code of a task.

type Runner added in v0.4.0

type Runner interface {
	RunTask(input ecs.RunTaskInput) ([]*ecs.Task, error)
}

Runner wraps the method of running tasks.

type Task added in v0.3.0

type Task struct {
	TaskARN    string
	ClusterARN string
	StartedAt  *time.Time
	ENI        string
}

Task represents a one-off workload that runs until completed or an error occurs.

type VPCGetter

type VPCGetter interface {
	SubnetIDs(filters ...ec2.Filter) ([]string, error)
	SecurityGroups(filters ...ec2.Filter) ([]string, error)
}

VPCGetter wraps methods of getting VPC info.

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