2023-11-30 11:56:32 +05:30
|
|
|
package processor
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/slack-go/slack/socketmode"
|
|
|
|
|
"houston/internal/processor/action"
|
|
|
|
|
"houston/logger"
|
|
|
|
|
"houston/pkg/slackbot"
|
2024-02-01 15:23:15 +05:30
|
|
|
rcaService "houston/service/rca/impl"
|
2023-11-30 11:56:32 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ResolveIncidentCommandProcessor struct {
|
|
|
|
|
socketModeClient *socketmode.Client
|
|
|
|
|
resolveIncidentCommandAction *action.ResolveIncidentCommandAction
|
2024-02-01 15:23:15 +05:30
|
|
|
rcaService *rcaService.RcaService
|
2023-11-30 11:56:32 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ResolveIncidentCommandProcessorLogTag = "[start_incident_command_processor]"
|
|
|
|
|
|
|
|
|
|
func NewResolveIncidentCommandProcessor(
|
|
|
|
|
socketModeClient *socketmode.Client,
|
|
|
|
|
slackBot *slackbot.Client,
|
2024-02-01 15:23:15 +05:30
|
|
|
rcaService *rcaService.RcaService,
|
2023-11-30 11:56:32 +05:30
|
|
|
) *ResolveIncidentCommandProcessor {
|
|
|
|
|
return &ResolveIncidentCommandProcessor{
|
|
|
|
|
socketModeClient: socketModeClient,
|
|
|
|
|
resolveIncidentCommandAction: action.NewResolveIncidentCommandAction(socketModeClient, slackBot, rcaService),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (processor *ResolveIncidentCommandProcessor) ProcessSlashCommand(event *socketmode.Event) {
|
|
|
|
|
defer func() {
|
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
|
logger.Error(fmt.Sprintf("%s Exception occurred: %+v", ResolveIncidentCommandProcessorLogTag, r.(error)))
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
processor.resolveIncidentCommandAction.PerformAction(event)
|
|
|
|
|
}
|