utils

package
v0.0.0-...-0117b6e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package utils provides utility functions to be used by interactors

Package utils provides utility functions to be used by interactors

Index

Constants

View Source
const (
	// CloudWatchLogGroupNamePrefix CloudWatch output's log group name prefix
	CloudWatchLogGroupNamePrefix = "/aws/ssm/"

	// SendCommandTopicPrefix is the topic prefix for a send command MDS message.
	SendCommandTopicPrefix TopicPrefix = "aws.ssm.sendCommand"

	// CancelCommandTopicPrefix is the topic prefix for a cancel command MDS message.
	CancelCommandTopicPrefix TopicPrefix = "aws.ssm.cancelCommand"

	// SendFailedReplyFrequencyMinutes is the frequency at which to send failed reply requests back to MDS
	SendFailedReplyFrequencyMinutes = 5
)

Variables

View Source
var (
	// DocumentWorkerName represents document worker name
	DocumentWorkerName = WorkerName(filepath.Base(appconfig.DefaultDocumentWorker))

	// SessionWorkerName represents session worker name
	SessionWorkerName = WorkerName(filepath.Base(appconfig.DefaultSessionWorker))
)

Functions

func IsValidReplyRequest

func IsValidReplyRequest(filename string, name contracts.UpstreamServiceName) bool

IsValidReplyRequest checks whether the reply is valid and had timed or not

func LoadProcessorWorkerConfig

func LoadProcessorWorkerConfig(context context.T) map[WorkerName]*ProcessorWorkerConfig

LoadProcessorWorkerConfig loads all the processor and worker configurations used for initializing processors We launch equal number of processors returned by this function in message handler

func ParseCancelCommandMessage

func ParseCancelCommandMessage(context context.T, msg model.InstanceMessage, upstreamService contracts.UpstreamServiceName) (*contracts.DocumentState, error)

ParseCancelCommandMessage parses send command message

func ParseSendCommandMessage

func ParseSendCommandMessage(context context.T, msg model.InstanceMessage, messagesOrchestrationRootDir string, upstreamService contracts.UpstreamServiceName) (*contracts.DocumentState, error)

ParseSendCommandMessage parses send command message

func PrepareReplyPayloadFromIntermediatePluginResults

func PrepareReplyPayloadFromIntermediatePluginResults(log log.T, pluginID string, agentInfo contracts.AgentInfo, outputs map[string]*contracts.PluginResult, ableToOpenMGSConnection *bool) (payload messageContracts.SendReplyPayload)

PrepareReplyPayloadFromIntermediatePluginResults parses send reply payload

func PrepareReplyPayloadToUpdateDocumentStatus

func PrepareReplyPayloadToUpdateDocumentStatus(agentInfo contracts.AgentInfo, documentStatus contracts.ResultStatus, documentTraceOutput string, ableToOpenMGSConnection *bool) (payload messageContracts.SendReplyPayload)

PrepareReplyPayloadToUpdateDocumentStatus creates the payload object for SendReply based on document status change.

func Validate

func Validate(msg *ssmmds.Message) error

Validate returns error if the message is invalid

Types

type ProcessorName

type ProcessorName string

ProcessorName represents the currently supported processor name

const (
	// CommandProcessor represents the command processor wrapper which handles send command and cancel command
	CommandProcessor ProcessorName = "CommandProcessor"

	// SessionProcessor represents the session processor wrapper which handles start session and terminate session
	SessionProcessor ProcessorName = "SessionProcessor"
)

type ProcessorWorkerConfig

type ProcessorWorkerConfig struct {
	ProcessorName           ProcessorName
	WorkerName              WorkerName
	StartWorkerLimit        int
	CancelWorkerLimit       int
	StartWorkerDocType      contracts.DocumentType
	CancelWorkerDocType     contracts.DocumentType
	StartWorkerBufferLimit  int
	CancelWorkerBufferLimit int
}

ProcessorWorkerConfig defines the different processor configurations along with worker details

type TopicPrefix

type TopicPrefix string

TopicPrefix is the prefix of the Topic field in an MDS message.

type WorkerName

type WorkerName string

WorkerName represents the currently supported workers

Jump to

Keyboard shortcuts

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