iamregistry

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package iamregistry provides data structures for resolving IAM roles and permissions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateRoles

func ValidateRoles(roles *iamv1.Roles) *errdetails.BadRequest

ValidateRoles validates a set of predefined roles.

Types

type ResourcePermissions added in v0.12.0

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

ResourcePermissions contain a mapping from resource types to permissions.

func NewResourcePermissions added in v0.12.0

func NewResourcePermissions(
	resourcePermissions *iamv1.ResourcePermissions,
	resources []*annotations.ResourceDescriptor,
) (*ResourcePermissions, error)

NewResourcePermissions creates a mapping of resource types to permissions.

func (*ResourcePermissions) FindPermissionByResourceName added in v0.12.0

func (r *ResourcePermissions) FindPermissionByResourceName(name string) (string, bool)

FindPermissionByResourceName looks up a permission by resource name.

type Roles

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

Roles are a set of roles.

func NewRoles

func NewRoles(roles *iamv1.Roles) (*Roles, error)

NewRoles creates a set of Roles from a pre-defined roles annotation.

func (*Roles) Count

func (r *Roles) Count() int

Count returns a count of the roles.

func (*Roles) FindRoleByName

func (r *Roles) FindRoleByName(name string) (*admin.Role, bool)

FindRoleByName looks up a role by resource name.

func (*Roles) RangeRoles

func (r *Roles) RangeRoles(fn func(*admin.Role) bool)

RangeRoles iterates over all registered roles while f returns true. The iteration order is undefined.

func (*Roles) RangeRolesByPermission

func (r *Roles) RangeRolesByPermission(permission string, fn func(*admin.Role) bool)

RangeRolesByPermission iterates over all registered roles with the provided permission while f returns true. The iteration order is undefined, and permissions with wildcards are not allowed.

func (*Roles) RoleHasPermission

func (r *Roles) RoleHasPermission(name, permission string) bool

RoleHasPermission checks whether the role with the provided name has the provided permission.

Jump to

Keyboard shortcuts

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