api

package
v1.36.2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachmentStateChange added in v1.28.0

type AttachmentStateChange struct {
	// Attachment is the eni attachment object to send
	Attachment *apieni.ENIAttachment
}

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

func NewAttachmentStateChangeEvent added in v1.28.0

func NewAttachmentStateChangeEvent(eniAttachment *apieni.ENIAttachment) AttachmentStateChange

NewAttachmentStateChangeEvent creates a new attachment state change event

func (AttachmentStateChange) GetEventType added in v1.28.0

GetEventType returns an enum identifying the event type

func (*AttachmentStateChange) String added in v1.28.0

func (change *AttachmentStateChange) String() string

String returns a human readable string representation of this object

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
	// PortBindings are the details of the host ports picked for the specified
	// container ports
	PortBindings []apicontainer.PortBinding

	// Container is a pointer to the container involved in the state change that gives the event handler a hook into
	// storing what status was sent.  This is used to ensure the same event is handled only once.
	Container *apicontainer.Container
}

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

func NewContainerStateChangeEvent added in v1.17.0

func NewContainerStateChangeEvent(task *apitask.Task, cont *apicontainer.Container, reason string) (ContainerStateChange, error)

NewContainerStateChangeEvent creates a new container state change event

func (ContainerStateChange) GetEventType added in v1.14.2

GetEventType returns an enum identifying the event type

func (*ContainerStateChange) String added in v1.3.1

func (c *ContainerStateChange) String() string

String returns a human readable string representation of this object

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)
	// 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
}

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 ECSSDK added in v1.1.0

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 added in v1.4.0

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 TaskStateChange added in v1.1.0

type TaskStateChange struct {
	// Attachment is the eni attachment object to send
	Attachment *apieni.ENIAttachment
	// 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 []ContainerStateChange

	// 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

	// Task is a pointer to the task involved in the state change that gives the event handler a hook into storing
	// what status was sent.  This is used to ensure the same event is handled only once.
	Task *apitask.Task
}

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

func NewTaskStateChangeEvent added in v1.17.0

func NewTaskStateChangeEvent(task *apitask.Task, reason string) (TaskStateChange, error)

NewTaskStateChangeEvent creates a new task state change event

func (TaskStateChange) GetEventType added in v1.14.2

func (TaskStateChange) GetEventType() statechange.EventType

GetEventType returns an enum identifying the event type

func (*TaskStateChange) SetTaskTimestamps added in v1.16.0

func (change *TaskStateChange) SetTaskTimestamps()

SetTaskTimestamps adds the timestamp information of task into the event to be sent by SubmitTaskStateChange

func (*TaskStateChange) ShouldBeReported added in v1.16.0

func (change *TaskStateChange) ShouldBeReported() bool

ShouldBeReported checks if the statechange should be reported to backend

func (*TaskStateChange) String added in v1.3.1

func (change *TaskStateChange) String() string

String returns a human readable string representation of this object

Directories

Path Synopsis
Package mock_api is a generated GoMock package.
Package mock_api is a generated GoMock package.
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.
Package testutils contains files that are used in tests but not elsewhere and thus can be excluded from the final executable.

Jump to

Keyboard shortcuts

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