policy

package
v0.0.0-...-69db04a Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARTITION = "judge-org"
	SERVICE   = "judge-server"
)

Variables

View Source
var (
	// ErrMalformedPolicy was return when the policy is malformed.
	ErrMalformedPolicy = errors.New("malformed policy")
)

Functions

This section is empty.

Types

type Policy

type Policy struct {
	// ID element specifies a global unique identifier for the policy.
	ID orn.ORN `json:"orn"`

	// Name element specifies a user friendly name for the policy.
	Name string `json:"name"`

	// Description element specifies description/usage about the policy.
	Description string `json:"description"`

	// Statements contains a list of Statement.
	Statements []Statement `json:"statement"`
}

Policy is an entity in Judge that, when attached to an identity, defines their permissions. Judge evaluates these policies when a principal, such as a user, makes a request. Permissions in the policies determine whether the request is allowed or denied.

func NewPolicy

func NewPolicy(name string, description string) (*Policy, error)

NewPolicy create a new policy document.

type Statement

type Statement struct {
	// Effect element is required and specifies whether the statement
	// results in an allow or an explicit deny. Valid values for Effect are
	// Allow and Deny.
	Effect string `json:"effect"`

	// Actions element describes the specific action or actions that will
	// be allowed or denied.
	Actions []string `json:"action"`

	// Resources element specifies the object or objects that the statement
	// covers.
	Resources []resource.Resource `json:"resource"`
}

The Statement element is the main element for a policy. It defines permissions.

func NewStatement

func NewStatement(effect string, actions []string, resources []string) (*Statement, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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