module documentation
Field mask utilities for partial updates and reset masks.
This module supplies small helpers that build, merge, and serialize Nebius API field masks. A mask is a field tree. You can serialize it to the dotted syntax for gRPC metadata, such as the X-ResetMask header.
Basic usage
Create a simple mask by hand and serialize it:
from nebius.base.fieldmask import FieldPath, Mask path = FieldPath(["spec", "max_size_bytes"]) mask = path.to_mask() serialized = mask.marshal() # serialized == "spec.max_size_bytes"
Merge masks:
mask = FieldPath(["spec", "max_size_bytes"]).to_mask() mask += FieldPath(["spec", "versioning"]).to_mask() # mask.marshal() == "spec.max_size_bytes,spec.versioning"
Use in request metadata (reset a field to its default):
from nebius.base.metadata import Metadata md = Metadata() md["X-ResetMask"] = "spec.max_size_bytes" # ... pass md into a request as metadata
Notes
- The internal mask format supports wildcards and nesting. Not all masks are representable as a single field path.
- Masks are more granular than standard Google field masks and are not directly compatible.
| Class | |
Field key component used in paths and mask trees. |
| Class | |
Ordered path of FieldKey components. |
| Class | |
Tree representation of a field mask. |
| Exception | |
Base error for field mask operations. |
| Exception | |
Raised when parsing or serializing field mask strings fails. |
| Variable | _simple |
Undocumented |