namer

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DerivedRolesPrefix      = fqnPrefix + "derived_roles"
	ExportVariablesPrefix   = fqnPrefix + "export_variables"
	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 ExportVariablesFQN added in v0.29.0

func ExportVariablesFQN(variablesName string) string

ExportVariablesFQN returns the fully-qualified module name for the given exported variable definitions.

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 RuleFQN added in v0.27.0

func RuleFQN(rpsMeta any, scope, ruleName string) string

RuleFQN returns the FQN for the resource rule or principal resource action rule with scope granularity.

func SimpleName added in v0.29.0

func SimpleName(fqn string) string

SimpleName extracts the simple name from a derived roles or exported variables FQN.

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 ExportVariablesModuleID added in v0.29.0

func ExportVariablesModuleID(variablesName string) ModuleID

ExportVariablesModuleID returns the module ID for the given exported variable definitions.

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 ScopedPrincipalPolicyModuleIDs added in v0.29.0

func ScopedPrincipalPolicyModuleIDs(principal, version, scope string, genTree bool) []ModuleID

ScopedPrincipalPolicyModuleIDs returns a list of module IDs for each scope segment if `strict` is false. For example, if the scope is `a.b.c`, the list will contain the module IDs for scopes `a.b.c`, `a.b`, `a` and `""` in that order.

func ScopedResourcePolicyModuleIDs added in v0.29.0

func ScopedResourcePolicyModuleIDs(resource, version, scope string, genTree bool) []ModuleID

ScopedResourcePolicyModuleIDs returns a list of module IDs for each scope segment if `strict` is false. For example, if the scope is `a.b.c`, the list will contain the module IDs for scopes `a.b.c`, `a.b`, `a` and `""` in that order.

func (*ModuleID) HexStr added in v0.26.0

func (m *ModuleID) HexStr() string

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 (PolicyCoords) FQN added in v0.13.0

func (pc PolicyCoords) FQN() string

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