namer

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DerivedRolesPrefix      = fqnPrefix + "derived_roles"
	PrincipalPoliciesPrefix = fqnPrefix + "principal"
	ResourcePoliciesPrefix  = fqnPrefix + "resource"

	DefaultVersion = "default"
)

Variables

This section is empty.

Functions

func DerivedRolesFQN added in v0.9.0

func DerivedRolesFQN(roleSetName string) string

DerivedRolesFQN returns the fully-qualified module name for the given derived roles set.

func DerivedRolesSimpleName

func DerivedRolesSimpleName(fqn string) string

DerivedRolesSimpleName extracts the simple name from a derived roles FQN.

func FQN added in v0.9.0

func FQN(p *policyv1.Policy) string

FQN returns the fully-qualified name of the policy.

func FQNFromPolicyKey added in v0.12.0

func FQNFromPolicyKey(s string) string

FQNFromPolicyKey returns FQN from the policy key.

func FQNTree added in v0.13.0

func FQNTree(p *policyv1.Policy) []string

FQNTree returns the tree of FQNs that are ancestors of the given policy (including itself) sorted by most recent to oldest. For example, if the policy has scope a.b.c, the returned tree will contain the FQNs in the following order: - a.b.c - a.b - a - "" (empty scope).

func PolicyKey

func PolicyKey(p *policyv1.Policy) string

PolicyKey returns a human-friendly identifier that can be used to refer to the policy in logs and other outputs.

func PolicyKeyFromFQN added in v0.9.0

func PolicyKeyFromFQN(m string) string

PolicyKeyFromFQN returns a policy key from the module name.

func PrincipalPolicyFQN added in v0.9.0

func PrincipalPolicyFQN(principal, version, scope string) string

PrincipalPolicyFQN returns the fully-qualified module name for the principal policy with given principal, version and scope.

func PrincipalResourceActionRuleName added in v0.9.0

func PrincipalResourceActionRuleName(rule *policyv1.PrincipalRule_Action, resource string, idx int) string

PrincipalResourceActionRuleName returns the name for an action rule defined for a particular resource.

func ResourcePolicyFQN added in v0.9.0

func ResourcePolicyFQN(resource, version, scope string) string

ResourcePolicyFQN returns the fully-qualified name for the resource policy with given resource, version and scope.

func ResourceRuleName added in v0.9.0

func ResourceRuleName(rule *policyv1.ResourceRule, idx int) string

ResourceRuleName returns the name of the given resource rule.

func Sanitize

func Sanitize(v string) string

Sanitize replaces special characters in the string with underscores.

Types

type ModuleID

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

ModuleID is a unique identifier for modules.

func DerivedRolesModuleID

func DerivedRolesModuleID(roleSetName string) ModuleID

DerivedRolesModuleID returns the module ID for the given derived roles set.

func GenModuleID

func GenModuleID(p *policyv1.Policy) ModuleID

GenModuleID generates a short ID for the module.

func GenModuleIDFromFQN added in v0.9.0

func GenModuleIDFromFQN(name string) ModuleID

GenModuleIDFromFQN generates a short ID for the given module name.

func PrincipalPolicyModuleID

func PrincipalPolicyModuleID(principal, version, scope string) ModuleID

PrincipalPolicyModuleID returns the module ID for the principal policy with given principal and version.

func ResourcePolicyModuleID

func ResourcePolicyModuleID(resource, version, scope string) ModuleID

ResourcePolicyModuleID returns the module ID for the resource policy with given resource, version and scope.

func (*ModuleID) Scan

func (m *ModuleID) Scan(src any) error

func (*ModuleID) String

func (m *ModuleID) String() string

func (ModuleID) Value

func (m ModuleID) Value() (driver.Value, error)

type PolicyCoords added in v0.13.0

type PolicyCoords struct {
	Kind    string
	Name    string
	Version string
	Scope   string
}

func PolicyCoordsFromPolicyKey added in v0.13.0

func PolicyCoordsFromPolicyKey(key string) (PolicyCoords, error)

func (PolicyCoords) FQN added in v0.13.0

func (pc PolicyCoords) FQN() string

func (PolicyCoords) ModuleID added in v0.13.0

func (pc PolicyCoords) ModuleID() ModuleID

func (PolicyCoords) PolicyKey added in v0.13.0

func (pc PolicyCoords) PolicyKey() string

Jump to

Keyboard shortcuts

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