namespaces

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const RootNamespaceID = "root"

RootNamespaceID is the ID of the root namespace.

View Source
const RootNamespacePath = ""

RootNamespacePath is the path of the root namespace.

Variables

View Source
var ErrNotFound = errors.New("no namespaces found")

ErrNotFound is returned by funcs in this package when something isn't found, instead of returning (nil, nil).

Functions

func DeleteAllNamespaces

func DeleteAllNamespaces(ctx context.Context, client *api.Client) error

DeleteAllNamespaces uses WalkNamespaces to delete all namespaces, waiting for deletion to complete before returning. The same caveats about namespaces changing underneath us apply as in WalkNamespaces. Traversal is depth-first pre-order, but we must do the deletion in the reverse order, since a namespace containing namespaces cannot be deleted.

func GetNamespaceIDPaths

func GetNamespaceIDPaths(client *api.Client) (map[string]string, error)

GetNamespaceIDPaths does a namespace list and extracts the resulting paths and namespace IDs, returning a map from namespace ID to path. Returns ErrNotFound if no namespaces exist beneath the current namespace set on the client.

func PollDeleteNamespace

func PollDeleteNamespace(ctx context.Context, client *api.Client, nsPath string) error

PollDeleteNamespace issues a namespace delete request and waits for it to complete (since namespace deletes are asynchronous), at least until ctx expires.

func WalkNamespaces

func WalkNamespaces(client *api.Client, f func(id, apiPath string) error) error

WalkNamespaces does recursive namespace list commands to discover the complete namespace hierarchy. This may yield an error or inconsistent results if namespaces change while we're querying them. The callback f is invoked for every namespace discovered. Namespace traversal is pre-order depth-first. If f returns an error, traversal is aborted and the error is returned. Otherwise, an error is only returned if a request results in an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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