Struct fiberplane_models::labels::Label
source · #[non_exhaustive]pub struct Label {
pub key: String,
pub value: String,
}Expand description
Labels that are associated with a Notebook.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.key: StringThe key of the label. Should be unique for a single Notebook.
value: StringThe value of the label. Can be left empty.
Implementations§
source§impl Label
impl Label
pub fn new(key: impl Into<String>, value: impl Into<String>) -> Self
sourcepub fn validate(&self) -> Result<(), LabelValidationError>
pub fn validate(&self) -> Result<(), LabelValidationError>
Validates the key and value.
sourcepub fn validate_key(key: &str) -> Result<(), LabelValidationError>
pub fn validate_key(key: &str) -> Result<(), LabelValidationError>
A key is considered valid if it adheres to the following criteria: It can contain two segments, a prefix and a name, the name segment has the following criteria:
- must be 63 characters or less (cannot be empty)
- must begin and end with an alphanumeric character ([a-z0-9A-Z])
- could contain dashes (-), underscores (_), dots (.), and alphanumerics between
The prefix is optional, if specified must follow the following criteria:
- must be 253 characters or less
- must be a valid DNS subdomain
sourcepub fn validate_value(value: &str) -> Result<(), LabelValidationError>
pub fn validate_value(value: &str) -> Result<(), LabelValidationError>
A value is considered valid if it adheres to the following criteria:
- must be 63 characters or less (can be empty)
- unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z])
- could contain dashes (-), underscores (_), dots (.), and alphanumerics between
Trait Implementations§
source§impl<'de> Deserialize<'de> for Label
impl<'de> Deserialize<'de> for Label
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more