accessrequest

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReviewReasonLimit
)

Slack has a 4000 character limit for message texts and 3000 character limit for message section texts, so we truncate all reasons to a generous but conservative limit

Variables

This section is empty.

Functions

func EncodePluginData

func EncodePluginData(data PluginData) (map[string]string, error)

EncodePluginData serializes a PluginData struct into a string map.

func MsgFields

func MsgFields(reqID string, reqData pd.AccessRequestData, clusterName string, webProxyURL *url.URL) string

func MsgReview

func MsgReview(review types.AccessReview) (string, error)

func MsgStatusText

func MsgStatusText(tag pd.ResolutionTag, reason string) string

func NewApp

func NewApp(bot MessagingBot) common.App

NewApp will create a new access request application.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the access request application for plugins. This will notify when access requests are created and reviewed.

func (*App) Err

func (a *App) Err() error

Err will return the error associated with the underlying job.

func (*App) Init

func (a *App) Init(baseApp *common.BaseApp) error

func (*App) Start

func (a *App) Start(process *lib.Process)

Start will start the application.

func (*App) WaitForDone

func (a *App) WaitForDone()

WaitForDone will wait until the job has completed.

func (*App) WaitReady

func (a *App) WaitReady(ctx context.Context) (bool, error)

WaitReady will block until the job is ready.

type MessageData

type MessageData struct {
	// ChannelID identifies a channel.
	ChannelID string
	// MessageID identifies a specific message in the channel.
	// For example: on Discord this is an ID while on Slack this is a timestamp.
	MessageID string
}

MessageData contains all the required information to identify and edit a message.

type MessagingBot

type MessagingBot interface {
	common.MessagingBot

	// BroadcastAccessRequestMessage sends an access request message to a list of Recipient
	BroadcastAccessRequestMessage(ctx context.Context, recipients []common.Recipient, reqID string, reqData pd.AccessRequestData) (data SentMessages, err error)
	// PostReviewReply posts in thread an access request review. This does nothing if the messaging service
	// does not support threaded replies.
	PostReviewReply(ctx context.Context, channelID string, threadID string, review types.AccessReview) error
	// UpdateMessages updates access request messages that were previously sent via Broadcast
	// This is used to change the access-request status and number of required approval remaining
	UpdateMessages(ctx context.Context, reqID string, data pd.AccessRequestData, messageData SentMessages, reviews []types.AccessReview) error
}

type PluginData

type PluginData struct {
	plugindata.AccessRequestData
	SentMessages
}

PluginData is a data associated with access request that we store in Teleport using UpdatePluginData API.

func DecodePluginData

func DecodePluginData(dataMap map[string]string) (PluginData, error)

DecodePluginData deserializes a string map to PluginData struct.

type SentMessages

type SentMessages []MessageData

Jump to

Keyboard shortcuts

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