policy

package
v0.0.0-...-fd51218 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdRW

type EtcdRW struct {
	Path   string
	Client etcd.Client
	Kapi   etcd.KeysAPI
}

func NewEtcdRW

func NewEtcdRW(path string) (*EtcdRW, error)

path is a comma separated list of etcd servers with key e.g., http://<ip1>:<port>/key/to/file,http://<ip2>:<port/key/to/file

func (*EtcdRW) Read

func (f *EtcdRW) Read() (string, error)

func (*EtcdRW) Write

func (f *EtcdRW) Write(content string) error

type FileRW

type FileRW struct {
	Path string
}

func NewFileRW

func NewFileRW(path string) (*FileRW, error)

func (*FileRW) Read

func (f *FileRW) Read() (string, error)

func (*FileRW) Write

func (f *FileRW) Write(content string) error

type Policy

type Policy struct {
	PolicyFile string // local file or etcd@http://<ip>:<port/path/to/file
	User       string // e.g., alice
	Namespace  string // e.g., alice_namespace
	Privileged bool   // e.g., false
	ReadOnly   bool   // e.g., false
	ReqType    string // e.g., add, delete
	RW         ReaderWriter
}

func New

func New() (*Policy, error)

func (*Policy) AddFlags

func (p *Policy) AddFlags(fs *flag.FlagSet)

func (*Policy) ProcessRequest

func (p *Policy) ProcessRequest() error

type ReaderWriter

type ReaderWriter interface {
	Read() (string, error)
	Write(content string) error
}

Jump to

Keyboard shortcuts

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