aws

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package aws provides abstractions that will be used for managing Amazon AWS resources

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotInitialized is returned when the fargate methods are invoked without initialization
	ErrNotInitialized = errors.New("fargate adapter is not initialized")
	ErrTaskRunFailure = errors.New("fargate task run failure")
	ErrNoTaskRun      = errors.New("fargate no tasks could be run")
)

Functions

This section is empty.

Types

type ConnectionSettings

type ConnectionSettings struct {
	Subnets        []*string
	SecurityGroups []*string
	EnablePublicIP bool
	UsePublicIP    bool
}

ConnectionSettings centralizes attributes related to the task's network configuration

type Fargate

type Fargate interface {
	// RunTask starts a new task in a pre configured Fargate
	RunTask(ctx context.Context, taskSettings TaskSettings, connection ConnectionSettings) (string, error)

	// WaitUntilTaskRunning blocks the request until the task is in "running"
	// state or failed to reach this state
	WaitUntilTaskRunning(ctx context.Context, taskARN string, cluster string, taskWaitConfig config.TaskWaitConfig) error

	// WaitUntilTaskHealthy blocks until the task is in "healthy" state if a
	// healthcheck is defined. It returns an error if the task failed to reach
	// a healthy state in the allotted time.
	WaitUntilTaskHealthy(ctx context.Context, taskARN string, cluster string, taskHealthWaitConfig config.TaskHealthWaitConfig) error

	// RunTask stops a specified Fargate task
	StopTask(ctx context.Context, taskARN, cluster, stopReason string) error

	// GetContainerIP returns the IP of the container related to the specified task
	GetContainerIP(ctx context.Context, taskARN string, cluster string, enablePublicIP bool, usePublicIP bool) (string, error)

	// Init initialize variables and executes necessary procedures
	Init() error
}

Fargate should be used to manage AWS Fargate Tasks (start, stop, etc)

func NewFargate

func NewFargate(logger logging.Logger, awsRegion, roleARN, stsSessionVars string) Fargate

NewFargate is a constructor for the concrete type of the Fargate interface

type MockFargate

type MockFargate struct {
	mock.Mock
}

MockFargate is an autogenerated mock type for the Fargate type

func NewMockFargate added in v0.3.0

func NewMockFargate(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockFargate

NewMockFargate creates a new instance of MockFargate. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockFargate) GetContainerIP

func (_m *MockFargate) GetContainerIP(ctx context.Context, taskARN string, cluster string, enablePublicIP bool, usePublicIP bool) (string, error)

GetContainerIP provides a mock function with given fields: ctx, taskARN, cluster, enablePublicIP, usePublicIP

func (*MockFargate) Init

func (_m *MockFargate) Init() error

Init provides a mock function with given fields:

func (*MockFargate) RunTask

func (_m *MockFargate) RunTask(ctx context.Context, taskSettings TaskSettings, connection ConnectionSettings) (string, error)

RunTask provides a mock function with given fields: ctx, taskSettings, connection

func (*MockFargate) StopTask

func (_m *MockFargate) StopTask(ctx context.Context, taskARN string, cluster string, stopReason string) error

StopTask provides a mock function with given fields: ctx, taskARN, cluster, stopReason

func (*MockFargate) WaitUntilTaskHealthy added in v0.4.0

func (_m *MockFargate) WaitUntilTaskHealthy(ctx context.Context, taskARN string, cluster string, taskHealthWaitConfig config.TaskHealthWaitConfig) error

WaitUntilTaskHealthy provides a mock function with given fields: ctx, taskARN, cluster, taskHealthWaitConfig

func (*MockFargate) WaitUntilTaskRunning

func (_m *MockFargate) WaitUntilTaskRunning(ctx context.Context, taskARN string, cluster string, taskWaitConfig config.TaskWaitConfig) error

WaitUntilTaskRunning provides a mock function with given fields: ctx, taskARN, cluster, taskWaitConfig

type TaskSettings added in v0.2.0

type TaskSettings struct {
	Cluster              string
	TaskDefinition       string
	PlatformVersion      string
	EnvironmentVariables map[string]string
	// Indicates whether to propagate the tags from the task definition to the running task
	PropagateTags bool
}

TaskSettings centralizes attributes related to the task configuration

Jump to

Keyboard shortcuts

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