Documentation ¶
Overview ¶
Package session deals with appropriately reacting to all ACS messages as well as maintaining the connection to ACS.
Index ¶
- Constants
- func NewAttachInstanceENIResponder(eniHandler ENIHandler, responseSender wsclient.RespondFunc) wsclient.RequestResponder
- func NewAttachResourceResponder(resourceHandler ResourceHandler, metricsFactory metrics.EntryFactory, ...) wsclient.RequestResponder
- func NewAttachTaskENIResponder(eniHandler ENIHandler, responseSender wsclient.RespondFunc) wsclient.RequestResponder
- func NewHeartbeatResponder(doctor *doctor.Doctor, responseSender wsclient.RespondFunc) wsclient.RequestResponder
- func NewPayloadResponder(payloadMessageHandler PayloadMessageHandler, ...) wsclient.RequestResponder
- func NewRefreshCredentialsResponder(credentialsManager credentials.Manager, ...) wsclient.RequestResponder
- func NewTaskManifestResponder(taskComparer TaskComparer, snAccessor SequenceNumberAccessor, ...) wsclient.RequestResponder
- func NewTaskStopVerificationACKResponder(taskStopper TaskStopper, messageIDAccessor ManifestMessageIDAccessor, ...) wsclient.RequestResponder
- type CredentialsMetadataSetter
- type ENIHandler
- type ManifestMessageIDAccessor
- type PayloadMessageHandler
- type ResourceHandler
- type SequenceNumberAccessor
- type Session
- type TaskComparer
- type TaskStopper
Constants ¶
const ( AttachResourceMessageName = "ConfirmAttachmentMessage" // DefaultAttachmentWaitTimeoutInMs is the default timeout, 5 minutes, for handling the attachments from ACS. DefaultAttachmentWaitTimeoutInMs = 300000 )
const (
AttachInstanceENIMessageName = "AttachInstanceNetworkInterfacesMessage"
)
const (
AttachTaskENIMessageName = "AttachTaskNetworkInterfacesMessage"
)
const (
PayloadMessageName = "PayloadMessage"
)
const (
RefreshCredentialsMessageName = "IAMRoleCredentialsMessage"
)
const (
TaskManifestMessageName = "TaskManifestMessage"
)
const (
TaskStopVerificationACKMessageName = "TaskStopVerificationACKMessage"
)
Variables ¶
This section is empty.
Functions ¶
func NewAttachInstanceENIResponder ¶
func NewAttachInstanceENIResponder(eniHandler ENIHandler, responseSender wsclient.RespondFunc) wsclient.RequestResponder
NewAttachInstanceENIResponder returns an instance of the attachInstanceENIResponder struct.
func NewAttachResourceResponder ¶
func NewAttachResourceResponder(resourceHandler ResourceHandler, metricsFactory metrics.EntryFactory, responseSender wsclient.RespondFunc) wsclient.RequestResponder
func NewAttachTaskENIResponder ¶
func NewAttachTaskENIResponder(eniHandler ENIHandler, responseSender wsclient.RespondFunc) wsclient.RequestResponder
NewAttachTaskENIResponder returns an instance of the attachTaskENIResponder struct.
func NewHeartbeatResponder ¶
func NewHeartbeatResponder(doctor *doctor.Doctor, responseSender wsclient.RespondFunc) wsclient.RequestResponder
NewHeartbeatResponder returns an instance of the heartbeatResponder struct.
func NewPayloadResponder ¶
func NewPayloadResponder(payloadMessageHandler PayloadMessageHandler, responseSender wsclient.RespondFunc) wsclient.RequestResponder
NewPayloadResponder returns an instance of the payloadResponder struct.
func NewRefreshCredentialsResponder ¶
func NewRefreshCredentialsResponder(credentialsManager credentials.Manager, credsMetadataSetter CredentialsMetadataSetter, metricsFactory metrics.EntryFactory, responseSender wsclient.RespondFunc) wsclient.RequestResponder
NewRefreshCredentialsResponder returns an instance of the refreshCredentialsResponder struct.
func NewTaskManifestResponder ¶
func NewTaskManifestResponder(taskComparer TaskComparer, snAccessor SequenceNumberAccessor, messageIDAccessor ManifestMessageIDAccessor, metricsFactory metrics.EntryFactory, responseSender wsclient.RespondFunc) wsclient.RequestResponder
NewTaskManifestResponder returns an instance of the taskManifestResponder struct.
func NewTaskStopVerificationACKResponder ¶
func NewTaskStopVerificationACKResponder( taskStopper TaskStopper, messageIDAccessor ManifestMessageIDAccessor, metricsFactory metrics.EntryFactory) wsclient.RequestResponder
NewTaskStopVerificationACKResponder returns an instance of the taskStopVerificationACKResponder struct.
Types ¶
type CredentialsMetadataSetter ¶
type CredentialsMetadataSetter interface { SetTaskRoleCredentialsMetadata(message *ecsacs.IAMRoleCredentialsMessage) error SetExecRoleCredentialsMetadata(message *ecsacs.IAMRoleCredentialsMessage) error }
type ENIHandler ¶
type ENIHandler interface {
HandleENIAttachment(eniAttachment *ni.ENIAttachment) error
}
type ManifestMessageIDAccessor ¶
type ManifestMessageIDAccessor interface { GetMessageID() string SetMessageID(messageID string) error }
ManifestMessageIDAccessor stores the latest message ID that corresponds to the most recently processed task manifest message and is used to determine the validity of a task stop verification ack message.
type PayloadMessageHandler ¶
type PayloadMessageHandler interface { ProcessMessage(message *ecsacs.PayloadMessage, ackFunc func(*ecsacs.AckRequest, []*ecsacs.IAMRoleCredentialsAckRequest)) error }
type ResourceHandler ¶
type ResourceHandler interface {
HandleResourceAttachment(Attachment *resource.ResourceAttachment)
}
type SequenceNumberAccessor ¶
type SequenceNumberAccessor interface { GetLatestSequenceNumber() int64 SetLatestSequenceNumber(seqNum int64) error }
SequenceNumberAccessor is used to get and set state for the current container instance. It sets and gets the latest sequence number that corresponds to the most recent task manifest that the task manifest responder has processed it alo sets the latest message id
type Session ¶
Session defines an interface for Agent's long-lived connection with ACS. The Session.Start() method can be used to start processing messages from ACS.
func NewSession ¶
func NewSession(containerInstanceARN string, cluster string, ecsClient ecs.ECSClient, credentialsProvider *credentials.Credentials, inactiveInstanceCB func(), clientFactory wsclient.ClientFactory, metricsFactory metrics.EntryFactory, agentVersion string, agentHash string, dockerVersion string, minAgentConfig *wsclient.WSClientMinAgentConfig, payloadMessageHandler PayloadMessageHandler, credentialsManager rolecredentials.Manager, credentialsMetadataSetter CredentialsMetadataSetter, doctor *doctor.Doctor, eniHandler ENIHandler, manifestMessageIDAccessor ManifestMessageIDAccessor, taskComparer TaskComparer, sequenceNumberAccessor SequenceNumberAccessor, taskStopper TaskStopper, resourceHandler ResourceHandler, addUpdateRequestHandlers func(wsclient.ClientServer), ) Session
NewSession creates a new Session.
type TaskComparer ¶
type TaskComparer interface {
CompareRunningTasksOnInstanceWithManifest(*ecsacs.TaskManifestMessage) ([]*ecsacs.TaskIdentifier, error)
}
TaskComparer gets and compares running tasks on an instance to those in the ACS manifest. It should be implemented by an underlying struct that has access to such data.
type TaskStopper ¶
type TaskStopper interface {
StopTask(taskARN string)
}
Source Files ¶
- attach_eni_common.go
- attach_instance_eni_responder.go
- attach_resource_responder.go
- attach_task_eni_responder.go
- generate_mocks.go
- heartbeat_responder.go
- payload_responder.go
- refresh_credentials_responder.go
- session.go
- task_manifest_common.go
- task_manifest_responder.go
- task_stop_verification_ack_responder.go