// newDocumentInfo initializes new DocumentInfo object func newDocumentInfo(msg ssmmds.Message, parsedMsg messageContracts.SendCommandPayload) messageContracts.DocumentInfo { documentInfo := new(messageContracts.DocumentInfo) documentInfo.CommandID = getCommandID(*msg.MessageId) documentInfo.Destination = *msg.Destination documentInfo.MessageID = *msg.MessageId documentInfo.RunID = times.ToIsoDashUTC(times.DefaultClock.Now()) documentInfo.CreatedDate = *msg.CreatedDate documentInfo.DocumentName = parsedMsg.DocumentName documentInfo.IsCommand = true documentInfo.DocumentStatus = contracts.ResultStatusInProgress documentInfo.DocumentTraceOutput = "" return *documentInfo }
// initializes CancelCommandState func initializeCancelCommandState(msg ssmmds.Message, parsedMsg messageContracts.CancelPayload) messageContracts.CancelCommandState { cancelCommand := new(messageContracts.CancelCommandState) cancelCommand.Destination = *msg.Destination cancelCommand.CreatedDate = *msg.CreatedDate cancelCommand.MessageID = *msg.MessageId cancelCommand.RunID = times.ToIsoDashUTC(times.DefaultClock.Now()) cancelCommand.Payload = *msg.Payload cancelCommand.Status = contracts.ResultStatusInProgress cancelCommand.CancelMessageID = parsedMsg.CancelMessageID commandID := getCommandID(parsedMsg.CancelMessageID) cancelCommand.CancelCommandID = commandID cancelCommand.DebugInfo = fmt.Sprintf("Command %v is yet to be cancelled", commandID) return *cancelCommand }