Documentation ¶
Index ¶
- func NewApp(conf *Config) *common.BaseApp
- type ChatMsgResponse
- type Config
- type DiscordBot
- func (b DiscordBot) BroadcastAccessRequestMessage(ctx context.Context, recipients []common.Recipient, reqID string, ...) (accessrequest.SentMessages, error)
- func (b DiscordBot) CheckHealth(ctx context.Context) error
- func (b DiscordBot) FetchRecipient(ctx context.Context, name string) (*common.Recipient, error)
- func (b DiscordBot) PostReviewReply(ctx context.Context, channelID, timestamp string, review types.AccessReview) error
- func (b DiscordBot) SendReviewReminders(ctx context.Context, recipients []common.Recipient, ...) error
- func (b DiscordBot) SupportedApps() []common.App
- func (b DiscordBot) UpdateMessages(ctx context.Context, reqID string, reqData pd.AccessRequestData, ...) error
- type DiscordEmbed
- type DiscordMsg
- type DiscordResponse
- type Msg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChatMsgResponse ¶
type ChatMsgResponse struct { DiscordResponse Channel string `json:"channel_id"` Text string `json:"content"` DiscordID string `json:"id"` }
type Config ¶
type Config struct { common.BaseConfig Discord common.GenericAPIConfig // Teleport is a handle to the client to use when communicating with // the Teleport auth server. The PagerDuty app will create a GRPC- // based client on startup if this is not set. Client teleport.Client // StatusSink receives any status updates from the plugin for // further processing. Status updates will be ignored if not set. StatusSink common.StatusSink }
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults checks the config struct for any logical errors, and sets default values if some values are missing. If critical values are missing and we can't set defaults for them — this will return an error.
func (*Config) GetTeleportClient ¶
GetTeleportClient implements PluginConfiguration. If a pre-created client was supplied on construction, this method will return that. If not, an RPC client will be created using the values in the config.
type DiscordBot ¶
type DiscordBot struct {
// contains filtered or unexported fields
}
DiscordBot is a discord client that works with AccessRequest. It's responsible for formatting and posting a message on Discord when an action occurs with an access request: a new request popped up, or a request is processed/updated.
func (DiscordBot) BroadcastAccessRequestMessage ¶
func (b DiscordBot) BroadcastAccessRequestMessage(ctx context.Context, recipients []common.Recipient, reqID string, reqData pd.AccessRequestData) (accessrequest.SentMessages, error)
BroadcastAccessRequestMessage posts request info to Discord.
func (DiscordBot) CheckHealth ¶
func (b DiscordBot) CheckHealth(ctx context.Context) error
func (DiscordBot) FetchRecipient ¶
func (DiscordBot) PostReviewReply ¶
func (b DiscordBot) PostReviewReply(ctx context.Context, channelID, timestamp string, review types.AccessReview) error
PostReviewReply does nothing as Discord does not have threaded replies
func (DiscordBot) SendReviewReminders ¶
func (b DiscordBot) SendReviewReminders(ctx context.Context, recipients []common.Recipient, accessList *accesslist.AccessList) error
SendReviewReminders will send a review reminder that an access list needs to be reviewed.
func (DiscordBot) SupportedApps ¶
func (b DiscordBot) SupportedApps() []common.App
SupportedApps are the apps supported by this bot.
func (DiscordBot) UpdateMessages ¶
func (b DiscordBot) UpdateMessages(ctx context.Context, reqID string, reqData pd.AccessRequestData, messagingData accessrequest.SentMessages, reviews []types.AccessReview) error
UpdateMessages updates already posted Discord messages
type DiscordEmbed ¶
type DiscordMsg ¶
type DiscordMsg struct { Msg Text string `json:"content,omitempty"` Embeds []DiscordEmbed `json:"embeds,omitempty"` }