role

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Prefix for all built-in roles.
	Prefix = string("os:")

	// Admin defines Talos role for admins.
	Admin = Role(Prefix + "admin")

	// Reader defines Talos role for readers who can access read-only APIs that do not expose secrets.
	Reader = Role(Prefix + "reader")

	// EtcdBackup defines Talos role that allows making etcd backups.
	EtcdBackup = Role(Prefix + "etcd:backup")

	// Impersonator defines Talos role for impersonating another user (and their role).
	// Used internally, but may also be granted to the user.
	Impersonator = Role(Prefix + "impersonator")
)

Variables

View Source
var (
	// All roles that can be granted to users.
	All = MakeSet(Admin, Reader, EtcdBackup, Impersonator)

	// Zero is an empty set of roles.
	Zero = MakeSet()
)

Functions

This section is empty.

Types

type Role

type Role string

Role represents Talos user role. Its string value is used everywhere: as the the Organization value of Talos client certificate, as the value of talosctl flag, etc.

type Set

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

Set represents a set of roles.

func MakeSet

func MakeSet(roles ...Role) Set

MakeSet makes a set of roles from constants. Use Parse in other cases.

func Parse

func Parse(str []string) (Set, []string)

Parse parses a set of roles. The returned set is always non-nil and contains all roles, including unknown (for compatibility with future versions). The returned slice contains roles unknown to the current version.

func (Set) Includes

func (s Set) Includes(role Role) bool

Includes returns true if given role is present in the set.

func (Set) IncludesAny

func (s Set) IncludesAny(other Set) bool

IncludesAny returns true if there is a non-empty intersection between sets.

Returns false if any set is empty.

func (Set) Strings

func (s Set) Strings() []string

Strings returns a set as a slice of strings.

Jump to

Keyboard shortcuts

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