Documentation
¶
Index ¶
- Variables
- func FindConfigFile(fileName string) string
- func GenerateEnrichedSlashResponse(title, text, color, respType string) []byte
- func GenerateIncomingWebhookRequest(channelName, title, text, color string) []byte
- func GenerateStandardSlashResponse(text string, respType string) string
- func LoadCommands()
- func LoadConfig(fileName string)
- func Log(level string, msg string, args ...interface{})
- func LogCritical(msg string, args ...interface{})
- func LogError(msg string, args ...interface{})
- func LogInfo(msg string, args ...interface{})
- func SendDialogRequest(url string, request *model.OpenDialogRequest)
- func SendViaIncomingHook(hook, channelName, title, text, color string)
- func Start()
- func Stop()
- func WriteEnrichedResponse(w http.ResponseWriter, title, resp, color, style string)
- func WriteErrorResponse(w http.ResponseWriter, err *AppError)
- func WriteResponse(w http.ResponseWriter, resp string, style string)
- type AppError
- type Color
- type DialogSession
- type DialogSubmission
- type HookResponse
- type MMSlashCommand
- type OpsCommand
- type OpsCommandDialog
- type OpsCommandDialogElement
- type OpsCommandDialogOption
- type OpsCommandOutput
- type OpsCommandResponse
- type OpsCommandVariable
- type OpsToolConfig
- type ScheduledCommand
Constants ¶
This section is empty.
Variables ¶
View Source
var DialogSessions map[string]*DialogSession = make(map[string]*DialogSession, 0)
View Source
var Providers map[string]*OpsCommand = make(map[string]*OpsCommand)
Functions ¶
func FindConfigFile ¶
func LoadCommands ¶
func LoadCommands()
func LoadConfig ¶
func LoadConfig(fileName string)
func LogCritical ¶
func LogCritical(msg string, args ...interface{})
func SendDialogRequest ¶
func SendDialogRequest(url string, request *model.OpenDialogRequest)
func SendViaIncomingHook ¶
func SendViaIncomingHook(hook, channelName, title, text, color string)
func WriteEnrichedResponse ¶
func WriteEnrichedResponse(w http.ResponseWriter, title, resp, color, style string)
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, err *AppError)
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, resp string, style string)
Types ¶
type DialogSession ¶
type DialogSession struct {
CallbackID string
MMHookURL string
SlashCommand *MMSlashCommand
OpsCommand *OpsCommand
}
type DialogSubmission ¶
type DialogSubmission struct {
Type string `json:"type"`
CallbackID string `json:"callback_id"`
State string `json:"state"`
UserID string `json:"user_id"`
ChannelID string `json:"channel_id"`
TeamID string `json:"team_id"`
//nolint:misspell // cancelled is misspelled but it is sent from mattermost-server.
Canceled bool `json:"cancelled"`
Submission map[string]string `json:"submission"`
}
func ParseDialogSubmission ¶
func ParseDialogSubmission(r *http.Request) (*DialogSubmission, error)
type HookResponse ¶
type MMSlashCommand ¶
type MMSlashCommand struct {
ChannelID string `schema:"channel_id"`
ChannelName string `schema:"channel_name"`
Command string `schema:"command"`
TeamName string `schema:"team_domain"`
TeamID string `schema:"team_id"`
Text string `schema:"text"`
Token string `schema:"token"`
UserID string `schema:"user_id"`
Username string `schema:"user_name"`
ResponseURL string `schema:"response_url"`
TriggerID string `schema:"trigger_id"`
}
func ParseSlashCommand ¶
func ParseSlashCommand(r *http.Request) (*MMSlashCommand, error)
type OpsCommand ¶
type OpsCommand struct {
Command string `yaml:"command"`
SubCommand string `yaml:"subcommand"`
Name string `yaml:"name"`
Description string `yaml:"description"`
Provides []string `yaml:"provides"`
ProvidedCommands []*OpsCommand `yaml:"-"`
Variables []OpsCommandVariable `yaml:"vars"`
Exec []string `yaml:"exec"`
Response OpsCommandResponse `yaml:"response"`
Users []string `yaml:"users"`
Dialog *OpsCommandDialog `yaml:"dialog"`
}
func (*OpsCommand) CanTrigger ¶
func (opsCmd *OpsCommand) CanTrigger(username string) bool
func (*OpsCommand) Execute ¶
func (opsCmd *OpsCommand) Execute(mmCommand *MMSlashCommand, args []string, envValues map[string]string) (*OpsCommandOutput, error)
type OpsCommandDialog ¶
type OpsCommandDialogElement ¶
type OpsCommandDialogElement struct {
DisplayName string `yaml:"display_name"`
Name string `yaml:"name"`
Type string `yaml:"type"`
SubType string `yaml:"subtype"`
Default string `yaml:"default"`
Placeholder string `yaml:"placeholder"`
HelpText string `yaml:"help_text"`
Optional bool `yaml:"optional"`
MinLength int `yaml:"min_length"`
MaxLength int `yaml:"max_length"`
Options []*OpsCommandDialogOption `yaml:"options"`
}
type OpsCommandDialogOption ¶
type OpsCommandOutput ¶
type OpsCommandOutput struct {
Status string `json:"status"`
Data interface{} `json:"data"`
}
type OpsCommandResponse ¶
type OpsCommandVariable ¶
type OpsToolConfig ¶
type OpsToolConfig struct {
Listen string `yaml:"listen"`
Token string `yaml:"token"`
CommandConfigurations []string `yaml:"commands"`
ScheduledCommands []*ScheduledCommand `yaml:"scheduler"`
}
var Config *OpsToolConfig = &OpsToolConfig{}
Click to show internal directories.
Click to hide internal directories.