ecs

package
v0.0.0-...-b702281 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachmentStateChange

type AttachmentStateChange struct {
	// Attachment is the attachment object to send.
	Attachment attachment.Attachment
}

AttachmentStateChange represents a state change that needs to be sent to the SubmitAttachmentStateChanges API.

func (*AttachmentStateChange) String

func (change *AttachmentStateChange) String() string

String returns a human readable string representation of an AttachmentStateChange.

type ContainerMetadataGetter

type ContainerMetadataGetter interface {
	GetContainerIsNil() bool
	GetContainerSentStatusString() string
	GetContainerRuntimeID() string
	GetContainerIsEssential() bool
}

ContainerMetadataGetter retrieves specific information about a given container that ECS client is concerned with.

type ContainerStateChange

type ContainerStateChange struct {
	// TaskArn is the unique identifier for the task.
	TaskArn string
	// RuntimeID is the dockerID of the container.
	RuntimeID string
	// ContainerName is the name of the container.
	ContainerName string
	// Status is the status to send.
	Status apicontainerstatus.ContainerStatus
	// ImageDigest is the sha-256 digest of the container image as pulled from the
	// repository.
	ImageDigest string
	// Reason may contain details of why the container stopped.
	Reason string
	// ExitCode is the exit code of the container, if available.
	ExitCode *int
	// NetworkBindings contains the details of the host ports picked for the specified
	// container ports.
	NetworkBindings []*ecs.NetworkBinding
	// MetadataGetter is used to retrieve other relevant information about the
	// container.
	MetadataGetter ContainerMetadataGetter
}

ContainerStateChange represents a state change that needs to be sent to the SubmitContainerStateChange API.

func (*ContainerStateChange) String

func (c *ContainerStateChange) String() string

String returns a human readable string representation of a ContainerStateChange.

type ECSClient

type ECSClient interface {
	// RegisterContainerInstance calculates the appropriate resources, creates
	// the default cluster if necessary, and returns the registered
	// ContainerInstanceARN if successful. Supplying a non-empty container
	// instance ARN allows a container instance to update its registered
	// resources.
	RegisterContainerInstance(existingContainerInstanceArn string,
		attributes []*ecs.Attribute, tags []*ecs.Tag, registrationToken string, platformDevices []*ecs.PlatformDevice,
		outpostARN string) (string, string, error)
	// SubmitTaskStateChange sends a state change and returns an error
	// indicating if it was submitted
	SubmitTaskStateChange(change TaskStateChange) error
	// SubmitContainerStateChange sends a state change and returns an error
	// indicating if it was submitted
	SubmitContainerStateChange(change ContainerStateChange) error
	// SubmitAttachmentStateChange sends an attachment state change and returns an error
	// indicating if it was submitted
	SubmitAttachmentStateChange(change AttachmentStateChange) error
	// DiscoverPollEndpoint takes a ContainerInstanceARN and returns the
	// endpoint at which this Agent should contact ACS
	DiscoverPollEndpoint(containerInstanceArn string) (string, error)
	// DiscoverTelemetryEndpoint takes a ContainerInstanceARN and returns the
	// endpoint at which this Agent should contact Telemetry Service
	DiscoverTelemetryEndpoint(containerInstanceArn string) (string, error)
	// DiscoverServiceConnectEndpoint takes a ContainerInstanceARN and returns the
	// endpoint at which this Agent should contact ServiceConnect
	DiscoverServiceConnectEndpoint(containerInstanceArn string) (string, error)
	// GetResourceTags retrieves the Tags associated with a certain resource
	GetResourceTags(resourceArn string) ([]*ecs.Tag, error)
	// UpdateContainerInstancesState updates the given container Instance ID with
	// the given status. Only valid statuses are ACTIVE and DRAINING.
	UpdateContainerInstancesState(instanceARN, status string) error
	// GetHostResources retrieves a map that map the resource name to the corresponding resource
	GetHostResources() (map[string]*ecs.Resource, error)
}

ECSClient is an interface over the ECSSDK interface which abstracts away some details around constructing the request and reading the response down to the parts the agent cares about. For example, the ever-present 'Cluster' member is abstracted out so that it may be configured once and used throughout transparently.

type ECSStandardSDK

ECSSDK is an interface that specifies the subset of the AWS Go SDK's ECS client that the Agent uses. This interface is meant to allow injecting a mock for testing.

type ECSSubmitStateSDK

type ECSSubmitStateSDK interface {
	SubmitContainerStateChange(*ecs.SubmitContainerStateChangeInput) (*ecs.SubmitContainerStateChangeOutput, error)
	SubmitTaskStateChange(*ecs.SubmitTaskStateChangeInput) (*ecs.SubmitTaskStateChangeOutput, error)
	SubmitAttachmentStateChanges(*ecs.SubmitAttachmentStateChangesInput) (*ecs.SubmitAttachmentStateChangesOutput, error)
}

ECSSubmitStateSDK is an interface with customized ecs client that implements the SubmitTaskStateChange and SubmitContainerStateChange

type ECSTaskProtectionSDK

type ECSTaskProtectionSDK interface {
	UpdateTaskProtection(input *ecs.UpdateTaskProtectionInput) (*ecs.UpdateTaskProtectionOutput, error)
	UpdateTaskProtectionWithContext(ctx aws.Context, input *ecs.UpdateTaskProtectionInput,
		opts ...request.Option) (*ecs.UpdateTaskProtectionOutput, error)
	GetTaskProtection(input *ecs.GetTaskProtectionInput) (*ecs.GetTaskProtectionOutput, error)
	GetTaskProtectionWithContext(ctx aws.Context, input *ecs.GetTaskProtectionInput,
		opts ...request.Option) (*ecs.GetTaskProtectionOutput, error)
}

ECSTaskProtectionSDK is an interface with customized ecs client that implements the UpdateTaskProtection and GetTaskProtection

type TaskMetadataGetter

type TaskMetadataGetter interface {
	GetTaskIsNil() bool
	GetTaskSentStatusString() string
	GetTaskPullStartedAt() time.Time
	GetTaskPullStoppedAt() time.Time
	GetTaskExecutionStoppedAt() time.Time
}

TaskMetadataGetter retrieves specific information about a given task that ECS client is concerned with.

type TaskStateChange

type TaskStateChange struct {
	// Attachment is the ENI attachment object to send.
	Attachment *ni.ENIAttachment
	// ClusterARN is the unique identifier for the cluster.
	ClusterARN string
	// TaskArn is the unique identifier for the task.
	TaskARN string
	// Status is the status to send.
	Status apitaskstatus.TaskStatus
	// Reason may contain details of why the task stopped.
	Reason string
	// Containers holds the events generated by containers owned by this task.
	Containers []*ecs.ContainerStateChange
	// ManagedAgents contain the name and status of Agents running inside the
	// container.
	ManagedAgents []*ecs.ManagedAgentStateChange
	// PullStartedAt is the timestamp when the task start pulling.
	PullStartedAt *time.Time
	// PullStoppedAt is the timestamp when the task finished pulling.
	PullStoppedAt *time.Time
	// ExecutionStoppedAt is the timestamp when the essential container stopped.
	ExecutionStoppedAt *time.Time
	// MetadataGetter is used to retrieve other relevant information about the task.
	MetadataGetter TaskMetadataGetter
}

TaskStateChange represents a state change that needs to be sent to the SubmitTaskStateChange API.

func (*TaskStateChange) String

func (change *TaskStateChange) String() string

String returns a human readable string representation of a TaskStateChange.

Directories

Path Synopsis
Package mock_ecs is a generated GoMock package.
Package mock_ecs is a generated GoMock package.
client
Package mock_client is a generated GoMock package.
Package mock_client is a generated GoMock package.
statechange
Package mock_statechange is a generated GoMock package.
Package mock_statechange is a generated GoMock package.
ecs

Jump to

Keyboard shortcuts

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