api

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2018 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnrecognizedTransportProtocolErrorName is an error where the protocol of the binding is invalid
	UnrecognizedTransportProtocolErrorName = "UnrecognizedTransportProtocol"
	// UnparseablePortErrorName is an error where the port configuration is invalid
	UnparseablePortErrorName = "UnparsablePort"
)
View Source
const (
	// DockerContainerMinimumMemoryInBytes is the minimum amount of
	// memory to be allocated to a docker container
	DockerContainerMinimumMemoryInBytes = 4 * 1024 * 1024 // 4MB
)
View Source
const InstanceTypeChangedErrorMessage = "Container instance type changes are not supported."

InstanceTypeChangedErrorMessage is the error message to print for the instance type changed error when registering a container instance

View Source
const OSType = "linux"

OSType is the type of operating system where agent is running

View Source
const (
	// PauseContainerName is the internal name for the pause container
	PauseContainerName = "~internal~ecs~pause"
)

Variables

This section is empty.

Functions

func IsInstanceTypeChangedError added in v1.3.1

func IsInstanceTypeChangedError(err error) bool

IsInstanceTypeChangedError returns true if the error when registering the container instance is because of instance type being changed

func PortBindingFromDockerPortBinding

func PortBindingFromDockerPortBinding(dockerPortBindings map[docker.Port][]docker.PortBinding) ([]PortBinding, NamedError)

PortBindingFromDockerPortBinding constructs a PortBinding slice from a docker NetworkSettings.Ports map.

func ValidateTaskENI added in v1.14.5

func ValidateTaskENI(acsenis []*ecsacs.ElasticNetworkInterface) error

ValidateTaskENI validates the eni informaiton sent from acs

Types

type Container

type Container struct {
	// Name is the name of the container specified in the task definition
	Name string
	// Image is the image name specified in the task definition
	Image string
	// ImageID is the local ID of the image used in the container
	ImageID string
	// Command is the command to run in the container which is specified in the task definition
	Command []string
	// CPU is the cpu limitation of the container which is specified in the task definition
	CPU uint `json:"Cpu"`
	// Memory is the memory limitation of the container which is specified in the task definition
	Memory uint
	// Links contains a list of containers to link, corresponding to docker option: --link
	Links []string
	// VolumesFrom contains a list of container's volume to use, corresponding to docker option: --volumes-from
	VolumesFrom []VolumeFrom `json:"volumesFrom"`
	// MountPoints contains a list of volume mount paths
	MountPoints []MountPoint `json:"mountPoints"`
	// Ports contains a list of ports binding configuration
	Ports []PortBinding `json:"portMappings"`
	// Essential denotes whether the container is essential or not
	Essential bool
	// EntryPoint is entrypoint of the container, corresponding to docker option: --entrypoint
	EntryPoint *[]string
	// Environment is the environment variable set in the container
	Environment map[string]string `json:"environment"`
	// Overrides contains the configuration to override of a container
	Overrides ContainerOverrides `json:"overrides"`
	// DockerConfig is the configuration used to create the container
	DockerConfig DockerConfig `json:"dockerConfig"`
	// RegistryAuthentication is the auth data used to pull image
	RegistryAuthentication *RegistryAuthenticationData `json:"registryAuthentication"`
	// HealthCheckType is the mechnism to use for the container health check
	// currently it only supports 'DOCKER'
	HealthCheckType string `json:"healthCheckType,omitempty"`
	// Health contains the health check information of container health check
	Health HealthStatus `json:"-"`
	// LogsAuthStrategy specifies how the logs driver for the container will be
	// authenticated
	LogsAuthStrategy string

	// DesiredStatusUnsafe represents the state where the container should go. Generally,
	// the desired status is informed by the ECS backend as a result of either
	// API calls made to ECS or decisions made by the ECS service scheduler,
	// though the agent may also set the DesiredStatusUnsafe if a different "essential"
	// container in the task exits. The DesiredStatus is almost always either
	// ContainerRunning or ContainerStopped.
	// NOTE: Do not access DesiredStatusUnsafe directly.  Instead, use `GetDesiredStatus`
	// and `SetDesiredStatus`.
	// TODO DesiredStatusUnsafe should probably be private with appropriately written
	// setter/getter.  When this is done, we need to ensure that the UnmarshalJSON
	// is handled properly so that the state storage continues to work.
	DesiredStatusUnsafe ContainerStatus `json:"desiredStatus"`

	// KnownStatusUnsafe represents the state where the container is.
	// NOTE: Do not access `KnownStatusUnsafe` directly.  Instead, use `GetKnownStatus`
	// and `SetKnownStatus`.
	// TODO KnownStatusUnsafe should probably be private with appropriately written
	// setter/getter.  When this is done, we need to ensure that the UnmarshalJSON
	// is handled properly so that the state storage continues to work.
	KnownStatusUnsafe ContainerStatus `json:"KnownStatus"`

	// TransitionDependencySet is a set of dependencies that must be satisfied
	// in order for this container to transition.  Each transition dependency
	// specifies a resource upon which the transition is dependent, a status
	// that depends on the resource, and the state of the dependency that
	// satisfies.
	TransitionDependencySet TransitionDependencySet `json:"TransitionDependencySet"`

	// SteadyStateDependencies is a list of containers that must be in "steady state" before
	// this one is created
	// Note: Current logic requires that the containers specified here are run
	// before this container can even be pulled.
	//
	// Deprecated: Use TransitionDependencySet instead. SteadyStateDependencies is retained for compatibility with old
	// state files.
	SteadyStateDependencies []string `json:"RunDependencies"`

	// Type specifies the container type. Except the 'Normal' type, all other types
	// are not directly specified by task definitions, but created by the agent. The
	// JSON tag is retained as this field's previous name 'IsInternal' for maintaining
	// backwards compatibility. Please see JSON parsing hooks for this type for more
	// details
	Type ContainerType `json:"IsInternal"`

	// AppliedStatus is the status that has been "applied" (e.g., we've called Pull,
	// Create, Start, or Stop) but we don't yet know that the application was successful.
	AppliedStatus ContainerStatus
	// ApplyingError is an error that occurred trying to transition the container
	// to its desired state. It is propagated to the backend in the form
	// 'Name: ErrorString' as the 'reason' field.
	ApplyingError *DefaultNamedError

	// SentStatusUnsafe represents the last KnownStatusUnsafe that was sent to the ECS
	// SubmitContainerStateChange API.
	// TODO SentStatusUnsafe should probably be private with appropriately written
	// setter/getter.  When this is done, we need to ensure that the UnmarshalJSON is
	// handled properly so that the state storage continues to work.
	SentStatusUnsafe ContainerStatus `json:"SentStatus"`

	// MetadataFileUpdated is set to true when we have completed updating the
	// metadata file
	MetadataFileUpdated bool `json:"metadataFileUpdated"`

	// KnownExitCodeUnsafe specifies the exit code for the container.
	// It is exposed outside of the package so that it's marshalled/unmarshalled in
	// the JSON body while saving the state.
	// NOTE: Do not access KnownExitCodeUnsafe directly. Instead, use `GetKnownExitCode`
	// and `SetKnownExitCode`.
	KnownExitCodeUnsafe *int `json:"KnownExitCode"`

	// KnownPortBindings is an array of port bindings for the container.
	KnownPortBindings []PortBinding

	// SteadyStateStatusUnsafe specifies the steady state status for the container
	// If uninitialized, it's assumed to be set to 'ContainerRunning'. Even though
	// it's not only supposed to be set when the container is being created, it's
	// exposed outside of the package so that it's marshalled/unmarshalled in the
	// the JSON body while saving the state
	SteadyStateStatusUnsafe *ContainerStatus `json:"SteadyStateStatus,omitempty"`
	// contains filtered or unexported fields
}

Container is the internal representation of a container in the ECS agent

func NewContainerWithSteadyState added in v1.14.5

func NewContainerWithSteadyState(steadyState ContainerStatus) *Container

NewContainerWithSteadyState creates a new Container object with the specified steady state. Containers that need the non default steady state set will use this method instead of setting it directly

func (*Container) AWSLogAuthExecutionRole added in v1.16.0

func (c *Container) AWSLogAuthExecutionRole() bool

AWSLogAuthExecutionRole returns true if the auth is by execution role

func (*Container) DesiredTerminal

func (c *Container) DesiredTerminal() bool

DesiredTerminal returns true if the container's desired status is STOPPED

func (*Container) GetCreatedAt added in v1.17.0

func (c *Container) GetCreatedAt() time.Time

GetCreatedAt sets the timestamp for container's creation time

func (*Container) GetDesiredStatus added in v1.12.2

func (c *Container) GetDesiredStatus() ContainerStatus

GetDesiredStatus gets the desired status of the container

func (*Container) GetFinishedAt added in v1.17.0

func (c *Container) GetFinishedAt() time.Time

GetFinishedAt sets the timestamp for container's stopped time

func (*Container) GetHealthStatus added in v1.17.0

func (c *Container) GetHealthStatus() HealthStatus

GetHealthStatus returns the container health information

func (*Container) GetKnownExitCode added in v1.14.4

func (c *Container) GetKnownExitCode() *int

GetKnownExitCode returns the container exit code

func (*Container) GetKnownStatus added in v1.12.2

func (c *Container) GetKnownStatus() ContainerStatus

GetKnownStatus returns the known status of the container

func (*Container) GetLabels added in v1.17.0

func (c *Container) GetLabels() map[string]string

GetLabels gets the labels for a container

func (*Container) GetNextKnownStateProgression added in v1.14.5

func (c *Container) GetNextKnownStateProgression() ContainerStatus

GetNextKnownStateProgression returns the state that the container should progress to based on its `KnownState`. The progression is incremental until the container reaches its steady state. From then on, it transitions to `ContainerStopped`.

For example: a. if the steady state of the container is defined as `ContainerRunning`, the progression is: Container: None -> Pulled -> Created -> Running* -> Stopped -> Zombie

b. if the steady state of the container is defined as `ContainerResourcesProvisioned`, the progression is: Container: None -> Pulled -> Created -> Running -> Provisioned* -> Stopped -> Zombie

c. if the steady state of the container is defined as `ContainerCreated`, the progression is: Container: None -> Pulled -> Created* -> Stopped -> Zombie

func (*Container) GetSentStatus added in v1.14.1

func (c *Container) GetSentStatus() ContainerStatus

GetSentStatus safely returns the SentStatusUnsafe of the container

func (*Container) GetStartedAt added in v1.17.0

func (c *Container) GetStartedAt() time.Time

GetStartedAt sets the timestamp for container's start time

func (*Container) GetSteadyStateStatus added in v1.14.5

func (c *Container) GetSteadyStateStatus() ContainerStatus

GetSteadyStateStatus returns the steady state status for the container. If Container.steadyState is not initialized, the default steady state status defined by `defaultContainerSteadyStateStatus` is returned. The 'pause' container's steady state differs from that of other containers, as the 'pause' container can reach its teady state once networking resources have been provisioned for it, which is done in the `ContainerResourcesProvisioned` state

func (*Container) HealthStatusShouldBeReported added in v1.17.0

func (c *Container) HealthStatusShouldBeReported() bool

HealthStatusShouldBeReported returns true if the health check is defined in the task definition

func (*Container) IsEssential added in v1.16.0

func (c *Container) IsEssential() bool

IsEssential returns whether the container is an essential container or not

func (*Container) IsInternal

func (c *Container) IsInternal() bool

IsInternal returns true if the container type is either `ContainerEmptyHostVolume` or `ContainerCNIPause`. It returns false otherwise

func (*Container) IsKnownSteadyState added in v1.14.5

func (c *Container) IsKnownSteadyState() bool

IsKnownSteadyState returns true if the `KnownState` of the container equals the `steadyState` defined for the container

func (*Container) IsMetadataFileUpdated added in v1.15.0

func (c *Container) IsMetadataFileUpdated() bool

IsMetadataFileUpdated returns true if the metadata file has been once the metadata file is ready and will no longer change

func (*Container) IsRunning added in v1.14.5

func (c *Container) IsRunning() bool

IsRunning returns true if the container's known status is either RUNNING or RESOURCES_PROVISIONED. It returns false otherwise

func (*Container) KnownTerminal

func (c *Container) KnownTerminal() bool

KnownTerminal returns true if the container's known status is STOPPED

func (*Container) SetCreatedAt added in v1.17.0

func (c *Container) SetCreatedAt(createdAt time.Time)

SetCreatedAt sets the timestamp for container's creation time

func (*Container) SetDesiredStatus added in v1.12.2

func (c *Container) SetDesiredStatus(status ContainerStatus)

SetDesiredStatus sets the desired status of the container

func (*Container) SetFinishedAt added in v1.17.0

func (c *Container) SetFinishedAt(finishedAt time.Time)

SetFinishedAt sets the timestamp for container's stopped time

func (*Container) SetHealthStatus added in v1.17.0

func (c *Container) SetHealthStatus(health HealthStatus)

SetHealthStatus sets the container health status

func (*Container) SetKnownExitCode added in v1.14.4

func (c *Container) SetKnownExitCode(i *int)

SetKnownExitCode sets exit code field in container struct

func (*Container) SetKnownStatus added in v1.12.2

func (c *Container) SetKnownStatus(status ContainerStatus)

SetKnownStatus sets the known status of the container

func (*Container) SetLabels added in v1.17.0

func (c *Container) SetLabels(labels map[string]string)

SetLabels sets the labels for a container

func (*Container) SetMetadataFileUpdated added in v1.15.0

func (c *Container) SetMetadataFileUpdated()

SetMetadataFileUpdated sets the container's MetadataFileUpdated status to true

func (*Container) SetRegistryAuthCredentials added in v1.16.0

func (c *Container) SetRegistryAuthCredentials(credential credentials.IAMRoleCredentials)

SetRegistryAuthCredentials sets the credentials for pulling image from ECR

func (*Container) SetSentStatus added in v1.14.1

func (c *Container) SetSentStatus(status ContainerStatus)

SetSentStatus safely sets the SentStatusUnsafe of the container

func (*Container) SetStartedAt added in v1.17.0

func (c *Container) SetStartedAt(startedAt time.Time)

SetStartedAt sets the timestamp for container's start time

func (*Container) ShouldPullWithExecutionRole added in v1.16.0

func (c *Container) ShouldPullWithExecutionRole() bool

ShouldPullWithExecutionRole returns whether this container has its own ECR credentials

func (*Container) String

func (c *Container) String() string

String returns a human readable string representation of this object

type ContainerDependency added in v1.14.5

type ContainerDependency struct {
	// ContainerName defines the container on which a transition depends
	ContainerName string `json:"ContainerName"`
	// SatisfiedStatus defines the status that satisfies the dependency
	SatisfiedStatus ContainerStatus `json:"SatisfiedStatus"`
	// DependentStatus defines the status that cannot be reached until the
	// resource satisfies the dependency
	DependentStatus ContainerStatus `json:"DependentStatus"`
}

ContainerDependency defines the relationship between a dependent container and its dependency.

type ContainerHealthStatus added in v1.17.0

type ContainerHealthStatus int32

ContainerHealthStatus is an enumeration of container health check status

const (
	// ContainerHealthUnknown is the initial status of container health
	ContainerHealthUnknown ContainerHealthStatus = iota
	// ContainerHealthy represents the status of container health check when returned healthy
	ContainerHealthy
	// ContainerUnhealthy represents the status of container health check when returned unhealthy
	ContainerUnhealthy
)

func (ContainerHealthStatus) BackendStatus added in v1.17.0

func (healthStatus ContainerHealthStatus) BackendStatus() string

BackendStatus returns the container health status recognized by backend

func (*ContainerHealthStatus) MarshalJSON added in v1.17.0

func (healthStatus *ContainerHealthStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the ContainerHealthStatus type

func (ContainerHealthStatus) String added in v1.17.0

func (healthStatus ContainerHealthStatus) String() string

String returns the readable description of the container health status

func (*ContainerHealthStatus) UnmarshalJSON added in v1.17.0

func (healthStatus *ContainerHealthStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded container health data

type ContainerOverrides

type ContainerOverrides struct {
	Command *[]string `json:"command"`
}

ContainerOverrides are overrides applied to the container

func (*ContainerOverrides) UnmarshalJSON

func (overrides *ContainerOverrides) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded ContainerOverrides data This custom unmarshaller is needed because the json sent to us as a string rather than a fully typed object. We support both formats in the hopes that one day everything will be fully typed Note: the `json:",string"` tag DOES NOT apply here; it DOES NOT work with struct types, only ints/floats/etc. We're basically doing that though We also intentionally fail if there are any keys we were unable to unmarshal into our struct

type ContainerOverridesCopy

type ContainerOverridesCopy ContainerOverrides

ContainerOverridesCopy is a type alias that doesn't have a custom unmarshaller so we can unmarshal ContainerOverrides data into something without recursing

type ContainerStateChange

type ContainerStateChange struct {
	// TaskArn is the unique identifier for the task
	TaskArn string
	// ContainerName is the name of the container
	ContainerName string
	// Status is the status to send
	Status ContainerStatus

	// 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 []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 *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 *Task, cont *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 ContainerStatus

type ContainerStatus int32

ContainerStatus is an enumeration of valid states in the container lifecycle

const (
	// ContainerStatusNone is the zero state of a container; this container has not completed pull
	ContainerStatusNone ContainerStatus = iota
	// ContainerPulled represents a container which has had the image pulled
	ContainerPulled
	// ContainerCreated represents a container that has been created
	ContainerCreated
	// ContainerRunning represents a container that has started
	ContainerRunning
	// ContainerResourcesProvisioned represents a container that has completed provisioning all of its
	// resources. Non-internal containers (containers present in the task definition) transition to
	// this state without doing any additional work. However, containers that are added to a task
	// by the ECS Agent would possibly need to perform additional actions before they can be
	// considered "ready" and contribute to the progress of a task. For example, the "pause" container
	// would be provisioned by invoking CNI plugins
	ContainerResourcesProvisioned
	// ContainerStopped represents a container that has stopped
	ContainerStopped
	// ContainerZombie is an "impossible" state that is used as the maximum
	ContainerZombie
)

func (*ContainerStatus) BackendStatus added in v1.14.5

func (cs *ContainerStatus) BackendStatus(steadyStateStatus ContainerStatus) ContainerStatus

BackendStatus maps the internal container status in the agent to that in the backend

func (ContainerStatus) IsRunning added in v1.14.5

func (cs ContainerStatus) IsRunning() bool

IsRunning returns true if the container status is either RUNNING or RESOURCES_PROVISIONED

func (*ContainerStatus) MarshalJSON

func (cs *ContainerStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the ContainerStatus type

func (*ContainerStatus) ShouldReportToBackend added in v1.14.5

func (cs *ContainerStatus) ShouldReportToBackend(steadyStateStatus ContainerStatus) bool

ShouldReportToBackend returns true if the container status is recognized as a valid state by ECS. Note that not all container statuses are recognized by ECS or map to ECS states

func (ContainerStatus) String

func (cs ContainerStatus) String() string

String returns a human readable string representation of this object

func (*ContainerStatus) TaskStatus

func (cs *ContainerStatus) TaskStatus(steadyStateStatus ContainerStatus) TaskStatus

TaskStatus maps the container status to the corresponding task status. The transition map is illustrated below.

Container: None -> Pulled -> Created -> Running -> Provisioned -> Stopped -> Zombie

Task : None -> Created -> Running -> Stopped

func (ContainerStatus) Terminal

func (cs ContainerStatus) Terminal() bool

Terminal returns true if the container status is STOPPED

func (*ContainerStatus) UnmarshalJSON

func (cs *ContainerStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded TaskStatus data

type ContainerType added in v1.14.5

type ContainerType int32

ContainerType represents the type of the internal container created

const (
	// ContainerNormal represents the container type for 'Normal' containers
	// These are the ones specified in the task definition via container
	// definitions
	ContainerNormal ContainerType = iota
	// ContainerEmptyHostVolume represents the internal container type
	// for the empty volumes container
	ContainerEmptyHostVolume
	// ContainerCNIPause represents the internal container type for the
	// pause container
	ContainerCNIPause
)

func (*ContainerType) MarshalJSON added in v1.14.5

func (containerType *ContainerType) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding a ContainerType object

func (ContainerType) String added in v1.14.5

func (containerType ContainerType) String() string

String converts the container type enum to a string

func (*ContainerType) UnmarshalJSON added in v1.14.5

func (containerType *ContainerType) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the container type field in the JSON encoded string into the ContainerType object

type DefaultNamedError added in v1.1.0

type DefaultNamedError struct {
	Err  string `json:"error"`
	Name string `json:"name"`
}

DefaultNamedError is a wrapper type for 'error' which adds an optional name and provides a symmetric marshal/unmarshal

func NewNamedError added in v1.1.0

func NewNamedError(err error) *DefaultNamedError

NewNamedError creates a NamedError.

func (*DefaultNamedError) Error added in v1.1.0

func (err *DefaultNamedError) Error() string

Error implements error

func (*DefaultNamedError) ErrorName added in v1.1.0

func (err *DefaultNamedError) ErrorName() string

ErrorName implements NamedError

type DockerClientConfigError added in v1.1.0

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

DockerClientConfigError represents the error caused by docker client

func (*DockerClientConfigError) Error added in v1.1.0

func (err *DockerClientConfigError) Error() string

Error returns the error as a string

func (*DockerClientConfigError) ErrorName added in v1.1.0

func (err *DockerClientConfigError) ErrorName() string

ErrorName returns the name of the error

type DockerConfig added in v1.5.0

type DockerConfig struct {
	// Config is the configuration used to create container
	Config *string `json:"config"`
	// HostConfig is the configuration of container related to host resource
	HostConfig *string `json:"hostConfig"`
	// Version specifies the docker client API version to use
	Version *string `json:"version"`
}

DockerConfig represents additional metadata about a container to run. It's remodeled from the `ecsacs` api model file. Eventually it should not exist once this remodeling is refactored out.

type DockerContainer

type DockerContainer struct {
	DockerID   string `json:"DockerId"`
	DockerName string // needed for linking

	Container *Container
}

DockerContainer is a mapping between containers-as-docker-knows-them and containers-as-we-know-them. This is primarily used in DockerState, but lives here such that tasks and containers know how to convert themselves into Docker's desired config format

func (*DockerContainer) String

func (dc *DockerContainer) String() string

String returns a human readable string representation of DockerContainer

type DockerEventType added in v1.17.0

type DockerEventType int

DockerEventType represents the type of docker events

const (
	// ContainerStatusEvent represents the container status change events from docker
	// currently create, start, stop, die, restart and oom event will have this type
	ContainerStatusEvent DockerEventType = iota
	// ContainerHealthEvent represents the container health status event from docker
	// "health_status: unhealthy" and "health_status: healthy" will have this type
	ContainerHealthEvent
)

func (DockerEventType) String added in v1.17.0

func (eventType DockerEventType) String() string

type ECRAuthData added in v1.7.0

type ECRAuthData struct {
	EndpointOverride string `json:"endpointOverride"`
	Region           string `json:"region"`
	RegistryID       string `json:"registryId"`
	UseExecutionRole bool   `json:"useExecutionRole"`
	// contains filtered or unexported fields
}

ECRAuthData is the authentication details for ECR specifying the region, registryID, and possible endpoint override

func (*ECRAuthData) GetPullCredentials added in v1.16.0

func (auth *ECRAuthData) GetPullCredentials() credentials.IAMRoleCredentials

GetPullCredentials returns the pull credentials in the auth

func (*ECRAuthData) SetPullCredentials added in v1.16.0

func (auth *ECRAuthData) SetPullCredentials(creds credentials.IAMRoleCredentials)

SetPullCredentials sets the credentials to pull from ECR in the auth

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

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

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

type ENI added in v1.14.5

type ENI struct {
	// ID is the id of eni
	ID string `json:"ec2Id"`
	// IPV4Addresses is the ipv4 address associated with the eni
	IPV4Addresses []*ENIIPV4Address
	// IPV6Addresses is the ipv6 address associated with the eni
	IPV6Addresses []*ENIIPV6Address
	// MacAddress is the mac address of the eni
	MacAddress string
	// DomainNameServers specifies the nameserver IP addresses for
	// the eni
	DomainNameServers []string `json:",omitempty"`
	// DomainNameSearchList specifies the search list for the domain
	// name lookup, for the eni
	DomainNameSearchList []string `json:",omitempty"`
}

ENI contains information of the eni

func ENIFromACS added in v1.14.5

func ENIFromACS(acsenis []*ecsacs.ElasticNetworkInterface) (*ENI, error)

ENIFromACS validates the information from acs message and create the ENI object

func (*ENI) GetIPV4Addresses added in v1.17.0

func (eni *ENI) GetIPV4Addresses() []string

GetIPV4Addresses returns a list of ipv4 addresses allocated to the ENI

func (*ENI) GetIPV6Addresses added in v1.17.0

func (eni *ENI) GetIPV6Addresses() []string

GetIPV6Addresses returns a list of ipv6 addresses allocated to the ENI

func (*ENI) String added in v1.15.0

func (eni *ENI) String() string

String returns a human readable version of the ENI object

type ENIAttachment added in v1.14.5

type ENIAttachment struct {
	// TaskARN is the task identifier from ecs
	TaskARN string `json:"taskArn"`
	// AttachmentARN is the identifier for the eni attachment
	AttachmentARN string `json:"attachmentArn"`
	// AttachStatusSent indicates whether the attached status has been sent to backend
	AttachStatusSent bool `json:"attachSent"`
	// MACAddress is the mac address of eni
	MACAddress string `json:"macAddress"`
	// Status is the status of the eni: none/attached/detached
	Status ENIAttachmentStatus `json:"status"`
	// ExpiresAt is the timestamp past which the ENI Attachment is considered
	// unsuccessful. The SubmitTaskStateChange API, with the attachment information
	// should be invoked before this timestamp.
	ExpiresAt time.Time `json:"expiresAt"`
	// contains filtered or unexported fields
}

ENIAttachment contains the information of the eni attachment

func (*ENIAttachment) HasExpired added in v1.15.0

func (eni *ENIAttachment) HasExpired() bool

HasExpired returns true if the ENI attachment object has exceeded the threshold for notifying the backend of the attachment

func (*ENIAttachment) IsSent added in v1.14.5

func (eni *ENIAttachment) IsSent() bool

IsSent checks if the eni attached status has been sent

func (*ENIAttachment) SetSentStatus added in v1.14.5

func (eni *ENIAttachment) SetSentStatus()

SetSentStatus marks the eni attached status has been sent

func (*ENIAttachment) StartTimer added in v1.14.5

func (eni *ENIAttachment) StartTimer(timeoutFunc func()) error

StartTimer starts the ack timer to record the expiration of ENI attachment

func (*ENIAttachment) StopAckTimer added in v1.14.5

func (eni *ENIAttachment) StopAckTimer()

StopAckTimer stops the ack timer set on the ENI attachment

func (*ENIAttachment) String added in v1.14.5

func (eni *ENIAttachment) String() string

String returns a string representation of the ENI Attachment

type ENIAttachmentStatus added in v1.14.5

type ENIAttachmentStatus int32

ENIAttachmentStatus is an enumeration type for eni attachment state

const (
	// ENIAttachmentNone is zero state of a task when received attachemessage from acs
	ENIAttachmentNone ENIAttachmentStatus = iota
	// ENIAttached represents that a eni has shown on the host
	ENIAttached
	// ENIDetached represents that a eni has been actually detached from the host
	ENIDetached
)

func (*ENIAttachmentStatus) ShouldSend added in v1.14.5

func (eni *ENIAttachmentStatus) ShouldSend() bool

ShouldSend returns whether the status should be sent to backend

func (*ENIAttachmentStatus) String added in v1.14.5

func (eni *ENIAttachmentStatus) String() string

String return the string value of the eniattachment status

type ENIIPV4Address added in v1.14.5

type ENIIPV4Address struct {
	// Primary indicates whether the ip address is primary
	Primary bool
	// Address is the ipv4 address associated with eni
	Address string
}

ENIIPV4Address is the ipv4 information of the eni

type ENIIPV6Address added in v1.14.5

type ENIIPV6Address struct {
	// Address is the ipv6 address associated with eni
	Address string
}

ENIIPV6Address is the ipv6 information of the eni

type EmptyHostVolume

type EmptyHostVolume struct {
	HostPath string `json:"hostPath"`
}

EmptyHostVolume represents a volume without a specified host path

func (*EmptyHostVolume) SourcePath

func (e *EmptyHostVolume) SourcePath() string

SourcePath returns the generated host path for the volume

type FSHostVolume

type FSHostVolume struct {
	FSSourcePath string `json:"sourcePath"`
}

FSHostVolume is a simple type of HostVolume which references an arbitrary location on the host as the Volume.

func (*FSHostVolume) SourcePath

func (fs *FSHostVolume) SourcePath() string

SourcePath returns the path on the host filesystem that should be mounted

type HealthStatus added in v1.17.0

type HealthStatus struct {
	// Status is the container health status
	Status ContainerHealthStatus `json:"status,omitempty"`
	// Since is the timestamp when container health status changed
	Since *time.Time `json:"statusSince,omitempty"`
	// ExitCode is the exitcode of health check if failed
	ExitCode int `json:"exitCode,omitempty"`
	// Output is the output of health check
	Output string `json:"output,omitempty"`
}

HealthStatus contains the health check result returned by docker

type HostConfigError added in v1.1.0

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

HostConfigError represents an error caused by host configuration

func (*HostConfigError) Error added in v1.1.0

func (err *HostConfigError) Error() string

Error returns the error as a string

func (*HostConfigError) ErrorName added in v1.1.0

func (err *HostConfigError) ErrorName() string

ErrorName returns the name of the error

type HostVolume

type HostVolume interface {
	SourcePath() string
}

HostVolume is an interface for something that may be used as the host half of a docker volume mount

type MountPoint

type MountPoint struct {
	SourceVolume  string `json:"sourceVolume"`
	ContainerPath string `json:"containerPath"`
	ReadOnly      bool   `json:"readOnly"`
}

MountPoint describes the in-container location of a Volume and references that Volume by name.

type NamedError added in v1.1.0

type NamedError interface {
	error
	ErrorName() string
}

NamedError defines an interface that wraps error and add additional 'ErrorName' method

type PortBinding

type PortBinding struct {
	// ContainerPort is the port inside the container
	ContainerPort uint16
	// HostPort is the port exposed on the host
	HostPort uint16
	// BindIP is the IP address to which the port is bound
	BindIP string `json:"BindIp"`
	// Protocol is the protocol of the port
	Protocol TransportProtocol
}

PortBinding represents a port binding for a container

type RegistryAuthenticationData added in v1.7.0

type RegistryAuthenticationData struct {
	Type        string       `json:"type"`
	ECRAuthData *ECRAuthData `json:"ecrAuthData"`
}

RegistryAuthenticationData is the authentication data sent by the ECS backend. Currently, the only supported authentication data is for ECR.

type Task

type Task struct {
	// Arn is the unique identifer for the task
	Arn string
	// Overrides are the overrides applied to a task
	Overrides TaskOverrides `json:"-"`
	// Family is the name of the task definition family
	Family string
	// Version is the version of the task definition
	Version string
	// Containers are the containers for the task
	Containers []*Container
	// Volumes are the volumes for the task
	Volumes []TaskVolume `json:"volumes"`
	// CPU is a task-level limit for compute resources. A value of 1 means that
	// the task may access 100% of 1 vCPU on the instance
	CPU float64 `json:"Cpu,omitempty"`
	// Memory is a task-level limit for memory resources in bytes
	Memory int64 `json:"Memory,omitempty"`
	// DesiredStatusUnsafe represents the state where the task should go. Generally,
	// the desired status is informed by the ECS backend as a result of either
	// API calls made to ECS or decisions made by the ECS service scheduler.
	// The DesiredStatusUnsafe is almost always either TaskRunning or TaskStopped.
	// NOTE: Do not access DesiredStatusUnsafe directly.  Instead, use `UpdateStatus`,
	// `UpdateDesiredStatus`, `SetDesiredStatus`, and `SetDesiredStatus`.
	// TODO DesiredStatusUnsafe should probably be private with appropriately written
	// setter/getter.  When this is done, we need to ensure that the UnmarshalJSON
	// is handled properly so that the state storage continues to work.
	DesiredStatusUnsafe TaskStatus `json:"DesiredStatus"`

	// KnownStatusUnsafe represents the state where the task is.  This is generally
	// the minimum of equivalent status types for the containers in the task;
	// if one container is at ContainerRunning and another is at ContainerPulled,
	// the task KnownStatusUnsafe would be TaskPulled.
	// NOTE: Do not access KnownStatusUnsafe directly.  Instead, use `UpdateStatus`,
	// and `GetKnownStatus`.
	// TODO KnownStatusUnsafe should probably be private with appropriately written
	// setter/getter.  When this is done, we need to ensure that the UnmarshalJSON
	// is handled properly so that the state storage continues to work.
	KnownStatusUnsafe TaskStatus `json:"KnownStatus"`
	// KnownStatusTimeUnsafe captures the time when the KnownStatusUnsafe was last updated.
	// NOTE: Do not access KnownStatusTime directly, instead use `GetKnownStatusTime`.
	KnownStatusTimeUnsafe time.Time `json:"KnownTime"`

	// PullStartedAtUnsafe is the timestamp when the task start pulling the first container,
	// it won't be set if the pull never happens
	PullStartedAtUnsafe time.Time `json:"PullStartedAt"`
	// PullStoppedAtUnsafe is the timestamp when the task finished pulling the last container,
	// it won't be set if the pull never happens
	PullStoppedAtUnsafe time.Time `json:"PullStoppedAt"`
	// ExecutionStoppedAtUnsafe is the timestamp when the task desired status moved to stopped,
	// which is when the any of the essential containers stopped
	ExecutionStoppedAtUnsafe time.Time `json:"ExecutionStoppedAt"`

	// SentStatusUnsafe represents the last KnownStatusUnsafe that was sent to the ECS SubmitTaskStateChange API.
	// TODO(samuelkarp) SentStatusUnsafe needs a lock and setters/getters.
	// TODO SentStatusUnsafe should probably be private with appropriately written
	// setter/getter.  When this is done, we need to ensure that the UnmarshalJSON
	// is handled properly so that the state storage continues to work.
	SentStatusUnsafe TaskStatus `json:"SentStatus"`

	StartSequenceNumber int64
	StopSequenceNumber  int64

	// ExecutionCredentialsID is the ID of credentials that are used by agent to
	// perform some action at the task level, such as pulling image from ECR
	ExecutionCredentialsID string `json:"executionCredentialsID"`

	// ENI is the elastic network interface specified by this task
	ENI *ENI

	// MemoryCPULimitsEnabled to determine if task supports CPU, memory limits
	MemoryCPULimitsEnabled bool `json:"MemoryCPULimitsEnabled,omitempty"`
	// contains filtered or unexported fields
}

Task is the internal representation of a task in the ECS agent

func RemoveFromTaskArray

func RemoveFromTaskArray(arr []*Task, ndx int) []*Task

RemoveFromTaskArray removes the element at ndx from an array of task pointers, arr. If the ndx is out of bounds, it returns arr unchanged.

func TaskFromACS added in v1.0.0

func TaskFromACS(acsTask *ecsacs.Task, envelope *ecsacs.PayloadMessage) (*Task, error)

TaskFromACS translates ecsacs.Task to api.Task by first marshaling the received ecsacs.Task to json and unmrashaling it as api.Task

func (*Task) ApplyExecutionRoleLogsAuth added in v1.16.0

func (task *Task) ApplyExecutionRoleLogsAuth(hostConfig *docker.HostConfig, credentialsManager credentials.Manager) *HostConfigError

ApplyExecutionRoleLogsAuth will check whether the task has execution role credentials, and add the genereated credentials endpoint to the associated HostConfig

func (*Task) BuildCNIConfig added in v1.14.5

func (task *Task) BuildCNIConfig() (*ecscni.Config, error)

BuildCNIConfig constructs the cni configuration from eni

func (*Task) BuildCgroupRoot added in v1.16.0

func (task *Task) BuildCgroupRoot() (string, error)

BuildCgroupRoot helps build the task cgroup prefix Example: /ecs/task-id

func (*Task) BuildLinuxResourceSpec added in v1.16.0

func (task *Task) BuildLinuxResourceSpec() (specs.LinuxResources, error)

BuildLinuxResourceSpec returns a linuxResources object for the task cgroup

func (*Task) ContainerByName

func (task *Task) ContainerByName(name string) (*Container, bool)

ContainerByName returns the *Container for the given name

func (*Task) DockerConfig

func (task *Task) DockerConfig(container *Container, apiVersion dockerclient.DockerVersion) (*docker.Config, *DockerClientConfigError)

DockerConfig converts the given container in this task to the format of GoDockerClient's 'Config' struct

func (*Task) DockerHostConfig

func (task *Task) DockerHostConfig(container *Container, dockerContainerMap map[string]*DockerContainer, apiVersion dockerclient.DockerVersion) (*docker.HostConfig, *HostConfigError)

DockerHostConfig construct the configuration recognized by docker

func (*Task) GetCredentialsID added in v1.14.2

func (task *Task) GetCredentialsID() string

GetCredentialsID gets the credentials ID for the task

func (*Task) GetDesiredStatus added in v1.13.0

func (task *Task) GetDesiredStatus() TaskStatus

GetDesiredStatus gets the desired status of the task

func (*Task) GetExecutionCredentialsID added in v1.16.0

func (task *Task) GetExecutionCredentialsID() string

GetExecutionCredentialsID gets the credentials ID for the task

func (*Task) GetExecutionStoppedAt added in v1.16.0

func (task *Task) GetExecutionStoppedAt() time.Time

GetExecutionStoppedAt returns the task executionStoppedAt timestamp

func (*Task) GetID added in v1.16.0

func (task *Task) GetID() (string, error)

GetID is used to retrieve the taskID from taskARN Reference: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-ecs

func (*Task) GetKnownStatus added in v1.9.0

func (task *Task) GetKnownStatus() TaskStatus

GetKnownStatus gets the KnownStatus of the task

func (*Task) GetKnownStatusTime added in v1.9.0

func (task *Task) GetKnownStatusTime() time.Time

GetKnownStatusTime gets the KnownStatusTime of the task

func (*Task) GetPullStartedAt added in v1.16.0

func (task *Task) GetPullStartedAt() time.Time

GetPullStartedAt returns the PullStartedAt timestamp

func (*Task) GetPullStoppedAt added in v1.16.0

func (task *Task) GetPullStoppedAt() time.Time

GetPullStoppedAt returns the PullStoppedAt timestamp

func (*Task) GetSentStatus added in v1.14.1

func (task *Task) GetSentStatus() TaskStatus

GetSentStatus safely returns the SentStatus of the task

func (*Task) GetStopSequenceNumber added in v1.16.0

func (task *Task) GetStopSequenceNumber() int64

GetStopSequenceNumber returns the stop sequence number of a task

func (*Task) GetTaskENI added in v1.14.5

func (task *Task) GetTaskENI() *ENI

GetTaskENI returns the eni of task, for now task can only have one enis

func (*Task) HostVolumeByName

func (task *Task) HostVolumeByName(name string) (HostVolume, bool)

HostVolumeByName returns the task Volume for the given a volume name in that task. The second return value indicates the presence of that volume

func (*Task) PostUnmarshalTask

func (task *Task) PostUnmarshalTask(cfg *config.Config, credentialsManager credentials.Manager)

PostUnmarshalTask is run after a task has been unmarshalled, but before it has been run. It is possible it will be subsequently called after that and should be able to handle such an occurrence appropriately (e.g. behave idempotently).

func (*Task) RecordExecutionStoppedAt added in v1.17.0

func (task *Task) RecordExecutionStoppedAt(container *Container)

RecordExecutionStoppedAt checks if this is an essential container stopped and set the task executionStoppedAt timestamps

func (*Task) SetConfigHostconfigBasedOnVersion added in v1.16.0

func (task *Task) SetConfigHostconfigBasedOnVersion(container *Container, config *docker.Config, hc *docker.HostConfig, apiVersion dockerclient.DockerVersion) error

SetConfigHostconfigBasedOnVersion sets the fields in both Config and HostConfig based on api version for backward compatibility

func (*Task) SetCredentialsID added in v1.14.2

func (task *Task) SetCredentialsID(id string)

SetCredentialsID sets the credentials ID for the task

func (*Task) SetDesiredStatus added in v1.13.0

func (task *Task) SetDesiredStatus(status TaskStatus)

SetDesiredStatus sets the desired status of the task

func (*Task) SetExecutionRoleCredentialsID added in v1.16.0

func (task *Task) SetExecutionRoleCredentialsID(id string)

SetExecutionRoleCredentialsID sets the ID for the task execution role credentials

func (*Task) SetExecutionStoppedAt added in v1.16.0

func (task *Task) SetExecutionStoppedAt(timestamp time.Time) bool

SetExecutionStoppedAt sets the ExecutionStoppedAt timestamp of the task

func (*Task) SetKnownStatus added in v1.1.0

func (task *Task) SetKnownStatus(status TaskStatus)

SetKnownStatus sets the known status of the task

func (*Task) SetPullStartedAt added in v1.16.0

func (task *Task) SetPullStartedAt(timestamp time.Time) bool

SetPullStartedAt sets the task pullstartedat timestamp and returns whether this field was updated or not

func (*Task) SetPullStoppedAt added in v1.16.0

func (task *Task) SetPullStoppedAt(timestamp time.Time)

SetPullStoppedAt sets the task pullstoppedat timestamp

func (*Task) SetSentStatus added in v1.14.1

func (task *Task) SetSentStatus(status TaskStatus)

SetSentStatus safely sets the SentStatus of the task

func (*Task) SetStopSequenceNumber added in v1.16.0

func (task *Task) SetStopSequenceNumber(seqnum int64)

SetStopSequenceNumber sets the stop seqence number of a task

func (*Task) SetTaskENI added in v1.14.5

func (task *Task) SetTaskENI(eni *ENI)

SetTaskENI sets the eni information of the task

func (*Task) String

func (task *Task) String() string

String returns a human readable string representation of this object

func (*Task) UpdateDesiredStatus added in v1.1.0

func (task *Task) UpdateDesiredStatus()

UpdateDesiredStatus sets the known status of the task

func (*Task) UpdateMountPoints

func (task *Task) UpdateMountPoints(cont *Container, vols map[string]string)

UpdateMountPoints updates the mount points of volumes that were created without specifying a host path. This is used as part of the empty host volume feature.

func (*Task) UpdateStatus added in v1.1.0

func (task *Task) UpdateStatus() bool

UpdateStatus updates a task's known and desired statuses to be compatible with all of its containers It will return a bool indicating if there was a change

type TaskOverrides

type TaskOverrides struct{}

TaskOverrides are the overrides applied to a task

type TaskStateChange added in v1.1.0

type TaskStateChange struct {
	// Attachment is the eni attachment object to send
	Attachment *ENIAttachment
	// TaskArn is the unique identifier for the task
	TaskARN string
	// Status is the status to send
	Status 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 *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 *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

type TaskStatus

type TaskStatus int32

TaskStatus is an enumeration of valid states in the task lifecycle

const (
	// TaskStatusNone is the zero state of a task; this task has been received but no further progress has completed
	TaskStatusNone TaskStatus = iota
	// TaskPulled represents a task which has had all its container images pulled, but not all have yet progressed passed pull
	TaskPulled
	// TaskCreated represents a task which has had all its containers created
	TaskCreated
	// TaskRunning represents a task which has had all its containers started
	TaskRunning
	// TaskStopped represents a task in which all containers are stopped
	TaskStopped
	// TaskZombie is an "impossible" state that is used as the maximum
	TaskZombie
)

func (*TaskStatus) BackendRecognized added in v1.1.0

func (ts *TaskStatus) BackendRecognized() bool

BackendRecognized returns true if the task status is recognized as a valid state by ECS. Note that not all task statuses are recognized by ECS or map to ECS states

func (*TaskStatus) BackendStatus added in v1.0.0

func (ts *TaskStatus) BackendStatus() string

BackendStatus maps the internal task status in the agent to that in the backend

func (*TaskStatus) ContainerStatus

func (ts *TaskStatus) ContainerStatus(steadyState ContainerStatus) ContainerStatus

ContainerStatus maps the task status to the corresponding container status

func (*TaskStatus) MarshalJSON

func (ts *TaskStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the TaskStatus type

func (TaskStatus) String

func (ts TaskStatus) String() string

String returns a human readable string representation of this object

func (TaskStatus) Terminal

func (ts TaskStatus) Terminal() bool

Terminal returns true if the Task status is STOPPED

func (*TaskStatus) UnmarshalJSON

func (ts *TaskStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded TaskStatus data

type TaskVolume

type TaskVolume struct {
	Name   string `json:"name"`
	Volume HostVolume
}

TaskVolume is a definition of all the volumes available for containers to reference within a task. It must be named.

func (*TaskVolume) MarshalJSON

func (tv *TaskVolume) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding a TaskVolume object

func (*TaskVolume) UnmarshalJSON

func (tv *TaskVolume) UnmarshalJSON(b []byte) error

UnmarshalJSON for TaskVolume determines the name and volume type, and unmarshals it into the appropriate HostVolume fulfilling interfaces

type TransitionDependencySet added in v1.14.5

type TransitionDependencySet struct {
	// ContainerDependencies is the set of containers on which a transition is
	// dependent.
	ContainerDependencies []ContainerDependency `json:"ContainerDependencies"`
}

TransitionDependencySet contains dependencies that impact transitions of containers.

type TransportProtocol added in v1.2.0

type TransportProtocol int32

TransportProtocol is an enumeration of valid transport protocols

const (
	// TransportProtocolTCP represents TCP
	TransportProtocolTCP TransportProtocol = iota
	// TransportProtocolUDP represents UDP
	TransportProtocolUDP
)

func NewTransportProtocol added in v1.2.0

func NewTransportProtocol(protocol string) (TransportProtocol, error)

NewTransportProtocol returns a TransportProtocol from a string in the task

func (*TransportProtocol) MarshalJSON added in v1.2.0

func (tp *TransportProtocol) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the TransportProtocol type

func (*TransportProtocol) String added in v1.2.0

func (tp *TransportProtocol) String() string

String converts TransportProtocol to a string

func (*TransportProtocol) UnmarshalJSON added in v1.2.0

func (tp *TransportProtocol) UnmarshalJSON(b []byte) error

UnmarshalJSON for TransportProtocol determines whether to use TCP or UDP, setting TCP as the zero-value but treating other unrecognized values as errors

type VolumeFrom

type VolumeFrom struct {
	SourceContainer string `json:"sourceContainer"`
	ReadOnly        bool   `json:"readOnly"`
}

VolumeFrom is a volume which references another container as its source.

Notes

Bugs

  • On Windows, volumes with names that differ only by case will collide

Directories

Path Synopsis
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