consulacl

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: MIT Imports: 5 Imported by: 0

README

consulacl

license GoDoc Build Status codecov Go Report Card

consulacl is a Go library which provides types and functions for working with consul ACL rules. This library is maintained by the Anexia R&D team.

Install

With a correctly configured Go toolchain:

go get -u github.com/anexia-it/consulacl

Issue tracker

Issues in consulacl are tracked using the corresponding GitHub project's issue tracker.

Status

The current release is v1.0.0.

Changes to consulacl are subject to semantic versioning.

License

consulacl is licensed under the terms of the MIT license.

Documentation

Overview

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

Index

Constants

View Source
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
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Grant

type Grant uint8

Grant defines the policy grant type

func GrantByName

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

func (g Grant) String() string

String returns the string representation of a grant

type GrantMap

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

GrantMap defines the type holding grant maps

func (*GrantMap) Clone

func (gm *GrantMap) Clone() *GrantMap

Clone creates a copy of the GrantMap

func (*GrantMap) Equals

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

Equals checks if the given GrantMap equals another GrantMap

func (*GrantMap) Get

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

Get retrieves the grant for a given target

func (*GrantMap) Is

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

func (gm *GrantMap) Remove(target string)

Remove removes the grant for the given target

func (*GrantMap) Set

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

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

Policy represents a consul ACL policy

func NewPolicy

func NewPolicy() *Policy

NewPolicy constructs a new policy

func NewPolicyFromACLPolicy

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

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

func (p *Policy) Agent() *GrantMap

Agent returns the agent GrantMap

func (*Policy) Clone

func (p *Policy) Clone() *Policy

Clone creates a copy of the policy

func (*Policy) Equals

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

Equals checks if the policy matches another policy

func (*Policy) Event

func (p *Policy) Event() *GrantMap

Event returns the event GrantMap

func (*Policy) GenerateRules

func (p *Policy) GenerateRules() string

GenerateRules constructs a rules string from the defined policy

func (*Policy) GetKeyring

func (p *Policy) GetKeyring() Grant

GetKeyring retrieves the keyring grant

func (*Policy) GetOperator

func (p *Policy) GetOperator() Grant

GetOperator retrieves the operator grant

func (*Policy) Key

func (p *Policy) Key() *GrantMap

Key returns the key GrantMap

func (*Policy) Node

func (p *Policy) Node() *GrantMap

Node returns the node GrantMap

func (*Policy) Query

func (p *Policy) Query() *GrantMap

Query returns the query GrantMap

func (*Policy) Service

func (p *Policy) Service() *GrantMap

Service returns the service GrantMap

func (*Policy) Session

func (p *Policy) Session() *GrantMap

Session returns the session GrantMap

func (*Policy) SetKeyring

func (p *Policy) SetKeyring(grant Grant)

SetKeyring configures the keyring grant

func (*Policy) SetOperator

func (p *Policy) SetOperator(grant Grant)

SetOperator configures the operator grant

Jump to

Keyboard shortcuts

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