NamespaceRequired returns the valid namespace from the context or an error.
(ctx context.Context)
| 67 | |
| 68 | // NamespaceRequired returns the valid namespace from the context or an error. |
| 69 | func 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 | } |
searching dependent graphs…