policy

package
v1.1.221 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	UpdatePolicy(policy Entity) error
	DeletePolicy(policy core.PolicyNameEntity) error
	ReadPolicy(policy core.PolicyNameEntity) (*Policy, error)
}

func NewAPI

func NewAPI(core core.API) API

type Body

type Body interface {
	GetPolicyRules() ([]*Rule, error)
}

type Capability

type Capability string
var (
	// CreateCapability gives permission to create objects.
	CreateCapability Capability = "create"
	// ReadCapability gives permission to read objects.
	ReadCapability Capability = "read"
	// UpdateCapability gives permission to update objects.
	UpdateCapability Capability = "update"
	// DeleteCapability gives permission to delete objects.
	DeleteCapability Capability = "delete"
	// ListCapability gives permission to list objects.
	ListCapability Capability = "list"
)

type Entity

type Entity interface {
	core.PolicyNameEntity
	Body
}

type Policy

type Policy struct {
	Name  string
	Rules []*Rule `hcl:"path,block"`
}

func (*Policy) GetPolicyName

func (p *Policy) GetPolicyName() (string, error)

func (*Policy) GetPolicyRules

func (p *Policy) GetPolicyRules() ([]*Rule, error)

func (*Policy) MarshalJSON

func (p *Policy) MarshalJSON() ([]byte, error)

func (*Policy) UnmarshalJSON

func (p *Policy) UnmarshalJSON(bytes []byte) error

type Rule

type Rule struct {
	Path         string       `hcl:"name,label"`
	Capabilities []Capability `hcl:"capabilities"`
}

Jump to

Keyboard shortcuts

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