groups

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Empty emptyGrouper

Empty is a grouper that returns not found for all groups.

View Source
var ErrCanceled = fmt.Errorf("cancled request for memberships")

ErrCanceled is used by Grouper implementations when the request was canceled before the group memberships could be determined.

View Source
var ErrNotFound = fmt.Errorf("not found")

ErrNotFound is used by Grouper implementations to signal a group is not found. Can be used as the cause in errors.Wrap if more context is required.

Use IsNotFound to detect this condition.

View Source
var ErrTimeout = fmt.Errorf("timeout retrieving memberships")

ErrTimeout is used by Grouper implementations to signal the grouper was unable to retrieve the memberships before the timeout was exceeded.

View Source
var ErrUnknown = fmt.Errorf("temporary error determining membership")

ErrUnknown is used by Grouper implementations to signal there was an error retrieving the group information with an unknown root cause. Can be used as the cause in errors.Wrap if more context is required.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the case of the error is ErrNotFound.

func IsUnknownMemberships added in v1.1.0

func IsUnknownMemberships(err error) bool

IsUnknownMemberships returns true if it is an intermittent error and should not change the memberships. Errors in the of this type may (timeouts) or may not resolve themselves (authentication issues). They indicate that the response data received is not reflective of the actual memberships.

func Normalize

func Normalize(subjects []rbacv1.Subject) []rbacv1.Subject

Normalize returns the slice of subjects sorted and unique.

The underlying argument slice is preserved.

func SortSubjects

func SortSubjects(subjects []rbacv1.Subject)

Types

type GroupMap

type GroupMap map[string][]rbacv1.Subject

GroupMap is simple map of group name to subjects.

Can be created with make or NewGroupMap.

func NewGroupMap

func NewGroupMap(m map[string][]rbacv1.Subject) GroupMap

NewGroupMap creates a group map from the provided map, ensuring that subjects are sorted and unique.

func (GroupMap) DeepCopy

func (gm GroupMap) DeepCopy() GroupMap

func (GroupMap) Members

func (gm GroupMap) Members(group string) ([]rbacv1.Subject, error)

func (GroupMap) MergeInto

func (gm GroupMap) MergeInto(other GroupMap) GroupMap

MergeInto takes another group map and merges into the receiver.

This peforms differently that merge, which returns the two original groups. This one modifies the group definitions into a single one.

The receiver is always returned.

type Grouper

type Grouper interface {
	Members(group string) ([]rbacv1.Subject, error)
}

Grouper returns the members of a group, as RBAC Subjects, given a group name.

If the group is unknown to the grouper, the error will return true for IsNotFound.

type Merged

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

func Merge

func Merge(groupers ...Grouper) Merged

Merge returns a merged grouper that will combine the subjects at runtime.

Underlying groupers remain untouched.

func (Merged) Members

func (m Merged) Members(group string) ([]rbacv1.Subject, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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