Documentation ¶
Index ¶
Constants ¶
const ( Unresolved = ResolutionTag("") ResolvedApproved = ResolutionTag("APPROVED") ResolvedDenied = ResolutionTag("DENIED") ResolvedExpired = ResolutionTag("EXPIRED") ResolvedPromoted = ResolutionTag("PROMOTED") )
Variables ¶
This section is empty.
Functions ¶
func EncodeAccessListNotificationData ¶
func EncodeAccessListNotificationData(data AccessListNotificationData) (map[string]string, error)
EncodeAccessListNotificationData deserializes a string map to PluginData struct.
func EncodeAccessRequestData ¶
func EncodeAccessRequestData(data AccessRequestData) (map[string]string, error)
EncodeAccessRequestData deserializes a string map to PluginData struct.
Types ¶
type AccessListNotificationData ¶
AccessListNotificationData represents generic plugin data required for access list notifications
func DecodeAccessListNotificationData ¶
func DecodeAccessListNotificationData(dataMap map[string]string) (data AccessListNotificationData, err error)
DecodeAccessListNotificationData deserializes a string map to PluginData struct.
type AccessRequestData ¶
type AccessRequestData struct { User string Roles []string RequestReason string ReviewsCount int ResolutionTag ResolutionTag ResolutionReason string SystemAnnotations map[string][]string Resources []string SuggestedReviewers []string }
AccessRequestData represents generic plugin data required for access request processing
func DecodeAccessRequestData ¶
func DecodeAccessRequestData(dataMap map[string]string) (data AccessRequestData, err error)
DecodeAccessRequestData deserializes a string map to PluginData struct.
type Client ¶
type Client interface { GetPluginData(context.Context, types.PluginDataFilter) ([]types.PluginData, error) UpdatePluginData(context.Context, types.PluginDataUpdateParams) error }
Client represents an interface to Teleport API client
type CompareAndSwap ¶
type CompareAndSwap[T any] struct { // contains filtered or unexported fields }
CompareAndSwap represents modifier struct
func NewCAS ¶
func NewCAS[T any]( client Client, name, kind string, encode func(T) (map[string]string, error), decode func(map[string]string) (T, error), ) *CompareAndSwap[T]
NewCAS returns modifier struct
func (*CompareAndSwap[T]) Create ¶
func (c *CompareAndSwap[T]) Create( ctx context.Context, resource string, newData T, ) (T, error)
Create tries to perform compare-and-swap update of a plugin data assuming that it does not exist
fn callback function receives current plugin data value and returns modified value and error.
Please note that fn might be called several times due to CAS backoff, hence, you must be careful with things like I/O ops and channels.
func (*CompareAndSwap[T]) Update ¶
func (c *CompareAndSwap[T]) Update( ctx context.Context, resource string, modifyT func(T) (T, error), ) (T, error)
Update tries to perform compare-and-swap update of a plugin data assuming that it exist
modifyT will receive existing plugin data and should return a modified version of the data.
If existing plugin data does not match expected data, then a trace.CompareFailed error should be returned to backoff and try again.
To abort the update, modifyT should return an error other, than trace.CompareFailed, which will be propagated back to the caller of `Update`.
type ResolutionTag ¶
type ResolutionTag string
ResolutionTag represents enum type of access request resolution constant