namespace

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotateNamespace added in v1.7.0

func AnnotateNamespace(ts *typesystem.ValidatedNamespaceTypeSystem) error

AnnotateNamespace annotates the namespace in the type system with computed aliasing and cache key metadata for more efficient dispatching.

func CheckNamespaceAndRelation added in v1.8.0

func CheckNamespaceAndRelation(
	ctx context.Context,
	namespace string,
	relation string,
	allowEllipsis bool,
	ds datastore.Reader,
) error

CheckNamespaceAndRelation checks that the specified namespace and relation exist in the datastore.

Returns datastore.NamespaceNotFoundError if the namespace cannot be found. Returns RelationNotFoundError if the relation was not found in the namespace. Returns the direct downstream error for all other unknown error.

func CheckNamespaceAndRelations added in v1.22.0

func CheckNamespaceAndRelations(ctx context.Context, checks []TypeAndRelationToCheck, ds datastore.Reader) error

CheckNamespaceAndRelations ensures that the given namespace+relation checks all succeed. If any fail, returns an error.

Returns NamespaceNotFoundError if the namespace cannot be found. Returns RelationNotFoundError if the relation was not found in the namespace. Returns the direct downstream error for all other unknown error.

func ListReferencedNamespaces added in v1.12.0

func ListReferencedNamespaces(nsdefs []*core.NamespaceDefinition) []string

ListReferencedNamespaces returns the names of all namespaces referenced in the given namespace definitions. This includes the namespaces themselves, as well as any found in type information on relations.

func NewDuplicateRelationError added in v1.13.0

func NewDuplicateRelationError(nsName string, relationName string) error

NewDuplicateRelationError constructs an error indicating that a relation was defined more than once in a namespace.

func NewNamespaceNotFoundErr

func NewNamespaceNotFoundErr(nsName string) error

NewNamespaceNotFoundErr constructs a new namespace not found error.

func NewPermissionsCycleErr added in v1.13.0

func NewPermissionsCycleErr(nsName string, permissionNames []string) error

NewPermissionsCycleErr constructs an error indicating that a cycle exists amongst permissions.

func NewRelationNotFoundErr

func NewRelationNotFoundErr(nsName string, relationName string) error

NewRelationNotFoundErr constructs a new relation not found error.

func NewUnusedCaveatParameterErr added in v1.14.0

func NewUnusedCaveatParameterErr(caveatName string, paramName string) error

NewUnusedCaveatParameterErr constructs indicating that a parameter was unused in a caveat expression.

func ReadNamespaceAndRelation added in v1.8.0

func ReadNamespaceAndRelation(
	ctx context.Context,
	namespace string,
	relation string,
	ds datastore.Reader,
) (*core.NamespaceDefinition, *core.Relation, error)

ReadNamespaceAndRelation checks that the specified namespace and relation exist in the datastore.

Returns NamespaceNotFoundError if the namespace cannot be found. Returns RelationNotFoundError if the relation was not found in the namespace. Returns the direct downstream error for all other unknown error.

func ValidateCaveatDefinition added in v1.14.0

func ValidateCaveatDefinition(caveat *core.CaveatDefinition) error

ValidateCaveatDefinition validates the parameters and types within the given caveat definition, including usage of the parameters.

Types

type DuplicateRelationError added in v1.39.0

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

DuplicateRelationError occurs when a duplicate relation was found inside a namespace.

func (DuplicateRelationError) DetailsMetadata added in v1.39.0

func (err DuplicateRelationError) DetailsMetadata() map[string]string

DetailsMetadata returns the metadata for details for this error.

func (DuplicateRelationError) MarshalZerologObject added in v1.39.0

func (err DuplicateRelationError) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog object marshalling.

type NamespaceNotFoundError added in v1.39.0

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

NamespaceNotFoundError occurs when a namespace was not found.

func (NamespaceNotFoundError) DetailsMetadata added in v1.39.0

func (err NamespaceNotFoundError) DetailsMetadata() map[string]string

DetailsMetadata returns the metadata for details for this error.

func (NamespaceNotFoundError) MarshalZerologObject added in v1.39.0

func (err NamespaceNotFoundError) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog object marshalling.

func (NamespaceNotFoundError) NotFoundNamespaceName added in v1.39.0

func (err NamespaceNotFoundError) NotFoundNamespaceName() string

NotFoundNamespaceName is the name of the namespace not found.

type PermissionsCycleError added in v1.39.0

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

PermissionsCycleError occurs when a cycle exists within permissions.

func (PermissionsCycleError) DetailsMetadata added in v1.39.0

func (err PermissionsCycleError) DetailsMetadata() map[string]string

DetailsMetadata returns the metadata for details for this error.

func (PermissionsCycleError) MarshalZerologObject added in v1.39.0

func (err PermissionsCycleError) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog object marshalling.

type RelationNotFoundError added in v1.39.0

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

RelationNotFoundError occurs when a relation was not found under a namespace.

func (RelationNotFoundError) DetailsMetadata added in v1.39.0

func (err RelationNotFoundError) DetailsMetadata() map[string]string

DetailsMetadata returns the metadata for details for this error.

func (RelationNotFoundError) MarshalZerologObject added in v1.39.0

func (err RelationNotFoundError) MarshalZerologObject(e *zerolog.Event)

func (RelationNotFoundError) NamespaceName added in v1.39.0

func (err RelationNotFoundError) NamespaceName() string

NamespaceName returns the name of the namespace in which the relation was not found.

func (RelationNotFoundError) NotFoundRelationName added in v1.39.0

func (err RelationNotFoundError) NotFoundRelationName() string

NotFoundRelationName returns the name of the relation not found.

type TypeAndRelationToCheck added in v1.22.0

type TypeAndRelationToCheck struct {
	// NamespaceName is the namespace name to ensure exists.
	NamespaceName string

	// RelationName is the relation name to ensure exists under the namespace.
	RelationName string

	// AllowEllipsis, if true, allows for the ellipsis as the RelationName.
	AllowEllipsis bool
}

TypeAndRelationToCheck is a single check of a namespace+relation pair.

type UnusedCaveatParameterError added in v1.39.0

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

UnusedCaveatParameterError indicates that a caveat parameter is unused in the caveat expression.

func (UnusedCaveatParameterError) DetailsMetadata added in v1.39.0

func (err UnusedCaveatParameterError) DetailsMetadata() map[string]string

DetailsMetadata returns the metadata for details for this error.

func (UnusedCaveatParameterError) MarshalZerologObject added in v1.39.0

func (err UnusedCaveatParameterError) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog object marshalling.

Jump to

Keyboard shortcuts

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