vault: github.com/hashicorp/vault/helper/namespace Index | Files

package namespace

import "github.com/hashicorp/vault/helper/namespace"

Index

Package Files

namespace.go

Constants

const (
    RootNamespaceID = "root"
)

Variables

var (
    ErrNoNamespace error      = errors.New("no namespace")
    RootNamespace  *Namespace = &Namespace{
        ID:   RootNamespaceID,
        Path: "",
    }
)

func Canonicalize Uses

func Canonicalize(nsPath string) string

Canonicalize trims any prefix '/' and adds a trailing '/' to the provided string

func ContextWithNamespace Uses

func ContextWithNamespace(ctx context.Context, ns *Namespace) context.Context

func RootContext Uses

func RootContext(ctx context.Context) context.Context

func SplitIDFromString Uses

func SplitIDFromString(input string) (string, string)

type Namespace Uses

type Namespace struct {
    ID   string `json:"id"`
    Path string `json:"path"`
}

func FromContext Uses

func FromContext(ctx context.Context) (*Namespace, error)

This function caches the ns to avoid doing a .Value lookup over and over, because it's called a *lot* in the request critical path. .Value is concurrency-safe so uses some kind of locking/atomicity, but it should never be read before first write, plus we don't believe this will be called from different goroutines, so it should be safe.

func (*Namespace) HasParent Uses

func (n *Namespace) HasParent(possibleParent *Namespace) bool

func (*Namespace) TrimmedPath Uses

func (n *Namespace) TrimmedPath(path string) string

Package namespace imports 3 packages (graph) and is imported by 20 packages. Updated 2018-11-11. Refresh now. Tools for package owners.