consulacl: github.com/anexia-it/consulacl Index | Files

package consulacl

import "github.com/anexia-it/consulacl"

Package consulacl provides types and functions for working with consul ACL rules

Index

Package Files

consulacl.go grant.go grant_map.go policy.go policy_rules.go

Constants

const (
    // GrantNone is fully virtual and defines that no access should be granted
    GrantNone = iota
    // GrantDeny defines that access should be denied
    GrantDeny
    // GrantList defines that listing is allowed (Consul 1.0+ with acl_enable_key_list policy configured)
    GrantList
    // GrantRead defines that read operations are allowed
    GrantRead
    // GrantWrite defines that write operations are allowed
    GrantWrite
)

type Grant Uses

type Grant uint8

Grant defines the policy grant type

func GrantByName Uses

func GrantByName(name string) Grant

GrantByName returns the grant by its specified name

If no grant by the given name could be found GrantNone will be returned

func (Grant) String Uses

func (g Grant) String() string

String returns the string representation of a grant

type GrantMap Uses

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

GrantMap defines the type holding grant maps

func (*GrantMap) Clone Uses

func (gm *GrantMap) Clone() *GrantMap

Clone creates a copy of the GrantMap

func (*GrantMap) Equals Uses

func (gm *GrantMap) Equals(other *GrantMap) bool

Equals checks if the given GrantMap equals another GrantMap

func (*GrantMap) Get Uses

func (gm *GrantMap) Get(target string) Grant

Get retrieves the grant for a given target

func (*GrantMap) Is Uses

func (gm *GrantMap) Is(target string, grant Grant) bool

Is checks if the grant for the given target is the same as provided

func (*GrantMap) Remove Uses

func (gm *GrantMap) Remove(target string)

Remove removes the grant for the given target

func (*GrantMap) Set Uses

func (gm *GrantMap) Set(target string, grant Grant)

Set applies the given grant for the given target

This method overrides potentially existing grants

type Policy Uses

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

Policy represents a consul ACL policy

func NewPolicy Uses

func NewPolicy() *Policy

NewPolicy constructs a new policy

func NewPolicyFromACLPolicy Uses

func NewPolicyFromACLPolicy(aclPolicy *acl.Policy) *Policy

NewPolicyFromACLPolicy constructs a new policy and fills its state with the state represented by the provided aclPolicy

func NewPolicyFromRules Uses

func NewPolicyFromRules(rules string) (*Policy, error)

NewPolicyFromRules constructs a new policy and fills its state with the state represented by the rules string

func (*Policy) Agent Uses

func (p *Policy) Agent() *GrantMap

Agent returns the agent GrantMap

func (*Policy) Clone Uses

func (p *Policy) Clone() *Policy

Clone creates a copy of the policy

func (*Policy) Equals Uses

func (p *Policy) Equals(other *Policy) bool

Equals checks if the policy matches another policy

func (*Policy) Event Uses

func (p *Policy) Event() *GrantMap

Event returns the event GrantMap

func (*Policy) GenerateRules Uses

func (p *Policy) GenerateRules() string

GenerateRules constructs a rules string from the defined policy

func (*Policy) GetKeyring Uses

func (p *Policy) GetKeyring() Grant

GetKeyring retrieves the keyring grant

func (*Policy) GetOperator Uses

func (p *Policy) GetOperator() Grant

GetOperator retrieves the operator grant

func (*Policy) Key Uses

func (p *Policy) Key() *GrantMap

Key returns the key GrantMap

func (*Policy) Node Uses

func (p *Policy) Node() *GrantMap

Node returns the node GrantMap

func (*Policy) Query Uses

func (p *Policy) Query() *GrantMap

Query returns the query GrantMap

func (*Policy) Service Uses

func (p *Policy) Service() *GrantMap

Service returns the service GrantMap

func (*Policy) Session Uses

func (p *Policy) Session() *GrantMap

Session returns the session GrantMap

func (*Policy) SetKeyring Uses

func (p *Policy) SetKeyring(grant Grant)

SetKeyring configures the keyring grant

func (*Policy) SetOperator Uses

func (p *Policy) SetOperator(grant Grant)

SetOperator configures the operator grant

Package consulacl imports 5 packages (graph). Updated 2018-05-23. Refresh now. Tools for package owners.