MCPcopy
hub / github.com/containerd/containerd / NamespaceRequired

Function NamespaceRequired

pkg/namespaces/context.go:69–78  ·  view source on GitHub ↗

NamespaceRequired returns the valid namespace from the context or an error.

(ctx context.Context)

Source from the content-addressed store, hash-verified

67
68// NamespaceRequired returns the valid namespace from the context or an error.
69func NamespaceRequired(ctx context.Context) (string, error) {
70 namespace, ok := Namespace(ctx)
71 if !ok || namespace == "" {
72 return "", fmt.Errorf("namespace is required: %w", errdefs.ErrFailedPrecondition)
73 }
74 if err := identifiers.Validate(namespace); err != nil {
75 return "", fmt.Errorf("namespace validation: %w", err)
76 }
77 return namespace, nil
78}

Callers 15

GetLabelMethod · 0.92
ActivateMethod · 0.92
DeactivateMethod · 0.92
InfoMethod · 0.92
ListMethod · 0.92
TestCreateDeleteFunction · 0.92
CreateMethod · 0.92
DeleteMethod · 0.92
ListMethod · 0.92
AddResourceMethod · 0.92
DeleteResourceMethod · 0.92
ListResourcesMethod · 0.92

Calls 2

ValidateFunction · 0.92
NamespaceFunction · 0.70

Tested by 2

TestCreateDeleteFunction · 0.74
createContentStoreFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…