Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteAllNamespaces(ctx context.Context, client *api.Client) error
- func GetNamespaceIDPaths(client *api.Client) (map[string]string, error)
- func PollDeleteNamespace(ctx context.Context, client *api.Client, nsPath string) error
- func WalkNamespaces(client *api.Client, f func(id, apiPath string) error) error
Constants ¶
const RootNamespaceID = "root"
RootNamespaceID is the ID of the root namespace.
const RootNamespacePath = ""
RootNamespacePath is the path of the root namespace.
Variables ¶
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 ¶
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 ¶
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 ¶
PollDeleteNamespace issues a namespace delete request and waits for it to complete (since namespace deletes are asynchronous), at least until ctx expires.
func WalkNamespaces ¶
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.