policy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

package policy handles Policy management for ACP.

Policies have multiple definition synxtaxes which gets mapped to a consistent internal implementation.

Index

Constants

View Source
const OwnerRelation string = "owner"

Variables

View Source
var (
	ErrInvalidPolicy = types.ErrAcpInput.Wrap("invalid policy")

	ErrUnknownMarshalingType = types.ErrAcpInput.Wrap("unknown marshaling type")
	ErrUnmarshaling          = types.ErrAcpInput.Wrap("unmarshaling error")

	ErrInvalidShortPolicy           = fmt.Errorf("invalid short policy: %w", ErrInvalidPolicy)
	ErrInvalidCreator               = fmt.Errorf("invalid creator: %w", ErrInvalidPolicy)
	ErrResourceMissingOwnerRelation = fmt.Errorf("resource missing owner relation: %w", ErrInvalidPolicy)
	ErrMalformedGraph               = fmt.Errorf("malformed management graph: %w", ErrInvalidPolicy)
)

Functions

This section is empty.

Types

type CreatePolicyCommand

type CreatePolicyCommand struct {
	// Cosmos Address of the Policy Creator
	Creator string

	// Policy Intermediary Representation
	Policy PolicyIR

	// Timestamp for Policy creation
	CreationTime *prototypes.Timestamp
}

CreatePolicyCommand models an instruction to createa a new ACP Policy

func (*CreatePolicyCommand) Execute

func (c *CreatePolicyCommand) Execute(ctx context.Context, accountKeeper types.AccountKeeper, engine auth_engine.AuthEngine) (*types.Policy, error)

Execute consumes the data supplied in the command and creates a new ACP Policy and stores it in the given engine.

type PolicyIR

type PolicyIR struct {
	Name          string
	Description   string
	Attributes    map[string]string
	Resources     []*types.Resource
	ActorResource *types.ActorResource
}

PolicyIR is an intermediary representation of a Policy which marshaled representations must unmarshall to.

func Unmarshal

func Unmarshal(pol string, t types.PolicyMarshalingType) (PolicyIR, error)

Jump to

Keyboard shortcuts

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