Documentation ¶
Index ¶
- func NewSlackApp(conf *Config) *common.BaseApp
- type APIResponse
- type AccessResponse
- type ActionsBlock
- type Authorizer
- type BaseMessage
- type Block
- type BlockItem
- type BlockType
- type Bot
- func (b Bot) BroadcastAccessRequestMessage(ctx context.Context, recipients []common.Recipient, reqID string, ...) (accessrequest.SentMessages, error)
- func (b Bot) CheckHealth(ctx context.Context) error
- func (b Bot) FetchRecipient(ctx context.Context, name string) (*common.Recipient, error)
- func (b Bot) PostReviewReply(ctx context.Context, channelID, timestamp string, review types.AccessReview) error
- func (b Bot) SendReviewReminders(ctx context.Context, recipient common.Recipient, ...) error
- func (b Bot) SupportedApps() []common.App
- func (b Bot) UpdateMessages(ctx context.Context, reqID string, reqData pd.AccessRequestData, ...) error
- type ChatMsgResponse
- type Config
- type ContextBlock
- type ContextElement
- type ContextElementItem
- type ContextElementType
- type DividerBlock
- type FileBlock
- type HeaderBlock
- type ImageBlock
- type InputBlock
- type MarkdownObject
- type Message
- type PlainTextObject
- type SectionBlock
- type TextObject
- type TextObjectItem
- type TextObjectType
- type User
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSlackApp ¶
NewSlackApp initializes a new teleport-slack app and returns it.
Types ¶
type APIResponse ¶
type AccessResponse ¶
type AccessResponse struct { APIResponse AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresInSeconds int `json:"expires_in"` }
type ActionsBlock ¶
type ActionsBlock struct { Elements []json.RawMessage `json:"elements"` BlockID string `json:"block_id,omitempty"` }
func (ActionsBlock) BlockType ¶
func (b ActionsBlock) BlockType() BlockType
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
Authorizer implements oauth2.Authorizer for Slack API.
func NewAuthorizer ¶
func NewAuthorizer(clientID string, clientSecret string) *Authorizer
NewAuthorizer returns a new Authorizer.
clientID is the Client ID for this Slack app as specified by OAuth2. clientSecret is the Client Secret for this Slack app as specified by OAuth2.
func (*Authorizer) Exchange ¶
func (a *Authorizer) Exchange(ctx context.Context, authorizationCode string, redirectURI string) (*storage.Credentials, error)
Exchange implements oauth.Exchanger
func (*Authorizer) Refresh ¶
func (a *Authorizer) Refresh(ctx context.Context, refreshToken string) (*storage.Credentials, error)
Refresh implements oauth.Refresher
type BaseMessage ¶
type BlockItem ¶
type BlockItem struct{ Block }
func NewBlockItem ¶
func (BlockItem) MarshalJSON ¶
func (*BlockItem) UnmarshalJSON ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot is a slack client that works with AccessRequest. It's responsible for formatting and posting a message on Slack when an action occurs with an access request: a new request popped up, or a request is processed/updated.
func (Bot) BroadcastAccessRequestMessage ¶
func (b Bot) BroadcastAccessRequestMessage(ctx context.Context, recipients []common.Recipient, reqID string, reqData pd.AccessRequestData) (accessrequest.SentMessages, error)
BroadcastAccessRequestMessage posts request info to Slack with action buttons.
func (Bot) FetchRecipient ¶
func (Bot) PostReviewReply ¶
func (Bot) SendReviewReminders ¶
func (b Bot) SendReviewReminders(ctx context.Context, recipient common.Recipient, accessList *accesslist.AccessList) error
SendReviewReminders will send a review reminder that an access list needs to be reviewed.
func (Bot) SupportedApps ¶
SupportedApps are the apps supported by this bot.
func (Bot) UpdateMessages ¶
func (b Bot) UpdateMessages(ctx context.Context, reqID string, reqData pd.AccessRequestData, slackData accessrequest.SentMessages, reviews []types.AccessReview) error
Expire updates request's Slack post with EXPIRED status and removes action buttons.
type ChatMsgResponse ¶
type ChatMsgResponse struct { APIResponse Channel string `json:"channel"` Timestamp string `json:"ts"` Text string `json:"text"` }
type Config ¶
type Config struct { common.BaseConfig Slack common.GenericAPIConfig AccessTokenProvider auth.AccessTokenProvider StatusSink common.StatusSink // contains filtered or unexported fields }
Config stores the full configuration for the teleport-slack plugin to run.
func LoadSlackConfig ¶
LoadSlackConfig reads the config file, initializes a new SlackConfig struct object, and returns it. Optionally returns an error if the file is not readable, or if file format is invalid.
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.
type ContextBlock ¶
type ContextBlock struct { ElementItems []ContextElementItem `json:"elements"` BlockID string `json:"block_id,omitempty"` }
func (ContextBlock) BlockType ¶
func (b ContextBlock) BlockType() BlockType
type ContextElement ¶
type ContextElement interface {
ContextElementType() ContextElementType
}
type ContextElementItem ¶
type ContextElementItem struct{ ContextElement }
func NewContextElementItem ¶
func NewContextElementItem(element ContextElement) ContextElementItem
func (ContextElementItem) MarshalJSON ¶
func (p ContextElementItem) MarshalJSON() ([]byte, error)
func (*ContextElementItem) UnmarshalJSON ¶
func (p *ContextElementItem) UnmarshalJSON(data []byte) error
type ContextElementType ¶
type ContextElementType string
type DividerBlock ¶
type DividerBlock struct {
BlockID string `json:"block_id,omitempty"`
}
func (DividerBlock) BlockType ¶
func (b DividerBlock) BlockType() BlockType
type FileBlock ¶
type HeaderBlock ¶
func (HeaderBlock) BlockType ¶
func (b HeaderBlock) BlockType() BlockType
type ImageBlock ¶
type ImageBlock struct { ImageURL string `json:"image_url"` AltText string `json:"alt_text,omitempty"` Title json.RawMessage `json:"title,omitempty"` BlockID string `json:"block_id,omitempty"` }
func (ImageBlock) BlockType ¶
func (b ImageBlock) BlockType() BlockType
type InputBlock ¶
type InputBlock struct { Label json.RawMessage `json:"label"` Element json.RawMessage `json:"element"` DispatchAction bool `json:"dispatch_action,omitempty"` BlockID string `json:"block_id,omitempty"` Hint json.RawMessage `json:"hint,omitempty"` Optional bool `json:"optional,omitempty"` }
func (InputBlock) BlockType ¶
func (b InputBlock) BlockType() BlockType
type MarkdownObject ¶
func (MarkdownObject) ContextElementType ¶
func (t MarkdownObject) ContextElementType() ContextElementType
func (MarkdownObject) GetText ¶
func (t MarkdownObject) GetText() string
func (MarkdownObject) TextObjectType ¶
func (t MarkdownObject) TextObjectType() TextObjectType
type Message ¶
type Message struct { BaseMessage BlockItems []BlockItem `json:"blocks,omitempty"` Text string `json:"text,omitempty"` }
type PlainTextObject ¶
func (PlainTextObject) ContextElementType ¶
func (t PlainTextObject) ContextElementType() ContextElementType
func (PlainTextObject) GetText ¶
func (t PlainTextObject) GetText() string
func (PlainTextObject) TextObjectType ¶
func (t PlainTextObject) TextObjectType() TextObjectType
type SectionBlock ¶
type SectionBlock struct { Text TextObjectItem `json:"text,omitempty"` BlockID string `json:"block_id,omitempty"` Fields []TextObjectItem `json:"fields,omitempty"` }
func (SectionBlock) BlockType ¶
func (b SectionBlock) BlockType() BlockType
type TextObject ¶
type TextObject interface { TextObjectType() TextObjectType GetText() string }
type TextObjectItem ¶
type TextObjectItem struct{ TextObject }
func NewTextObjectItem ¶
func NewTextObjectItem(object TextObject) TextObjectItem
func (TextObjectItem) MarshalJSON ¶
func (p TextObjectItem) MarshalJSON() ([]byte, error)
func (*TextObjectItem) UnmarshalJSON ¶
func (p *TextObjectItem) UnmarshalJSON(data []byte) error
type TextObjectType ¶
type TextObjectType string
type User ¶
type User struct { ID string `json:"id"` Name string `json:"name"` Profile UserProfile `json:"profile"` }
type UserProfile ¶
type UserProfile struct {
Email string `json:"email"`
}