fs

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 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 SecretDir

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

SecretDir implements Node and Handle This type is used for accessing all content in a VaultFS as everything maps to directory-like structures. Various lookups produce either a child SecretDir or a a StaticDir tree.

func NewSecretDir

func NewSecretDir(fs *VaultFS, lookupPath string) (*SecretDir, error)

NewSecretDir creates a SecretDir node linked to the given secret and vault API.

func (*SecretDir) Attr

func (s *SecretDir) Attr(ctx context.Context, a *fuse.Attr) error

Attr returns attributes about this Secret

func (*SecretDir) Lookup

func (s *SecretDir) Lookup(ctx context.Context, name string) (fs.Node, error)

Lookup looks up a path. Vault policies mean its non-obvious what will happen. In brief: a path we can't access due to permissions always returns an unpopulated secret dir, which allows traversing further down the tree. But, if we can access it, and confirm it doesn't exist, we return ENOENT instead.

func (*SecretDir) ReadDirAll

func (s *SecretDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

ReadDirAll returns a list of secrets in this directory

type SecretType added in v0.0.2

type SecretType int

SecretType is returned from internal lookup functions to track possibly changing key types.

const (
	// SecretTypeBackendError returned if a key is not accessible at all.
	SecretTypeBackendError SecretType = iota
	// SecretTypeInaccessible returned if a key is inaccessible, and should be
	// treated as an empty, traversable directory until found otherwise.
	SecretTypeInaccessible
	// SecretTypeNonExistent return if key is non-existent (i.e. deleted since
	// we got here)
	SecretTypeNonExistent
	// SecretTypeDirectory returned if a key is accessible and list'able and
	// should be directory like
	SecretTypeDirectory
	// SecretTypeSecret returned if a key is read'able, and should have
	// secret-like behavior
	SecretTypeSecret
)

type StaticDir

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

StaticDir implements a fuse directory structure with static content.

func NewStaticDir

func NewStaticDir(values map[string]interface{}) (*StaticDir, error)

NewStaticDir generates a new static directory tree of arbitrary depth from the supplied map.

func (*StaticDir) Attr

func (s *StaticDir) Attr(ctx context.Context, a *fuse.Attr) error

Attr sets attrs on the given fuse.Attr

func (*StaticDir) Lookup

func (s *StaticDir) Lookup(ctx context.Context, name string) (fs.Node, error)

Lookup looks up a path

func (*StaticDir) ReadDirAll

func (s *StaticDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

ReadDirAll enumerates the static content as files if a StaticValue or direcotries if another StaticDir.

type StaticValue

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

StaticValue implements a node which always serves the same bytes.

func NewValue

func NewValue(value string) (*StaticValue, error)

NewValue returns a new Value node (a file with static content)

func (*StaticValue) Attr

func (f *StaticValue) Attr(ctx context.Context, a *fuse.Attr) error

Attr sets attrs on the given fuse.Attr

func (*StaticValue) Read

func (f *StaticValue) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error

Read simply returns the statically stored content of the node.

type VaultFS

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

VaultFS is a vault filesystem. It also wraps the accessor functions needed by the filesystem nodes to manage access to backend keys in vault (i.e. error handling, failover and re-auth attempts.

func New

func New(config *api.Config, mountpoint string, root string, token string, authMethod string) (*VaultFS, error)

New returns a new VaultFS

func (*VaultFS) Mount

func (v *VaultFS) Mount() error

Mount the FS at the given mountpoint

func (*VaultFS) Root

func (v *VaultFS) Root() (fs.Node, error)

Root returns the struct that does the actual work

func (*VaultFS) Unmount

func (v *VaultFS) Unmount() error

Unmount the FS

Jump to

Keyboard shortcuts

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