Skip to main content

ConditionType

Derive Macro ConditionType 

Source
#[derive(ConditionType)]
{
    // Attributes available to this derive:
    #[dependent]
}
Expand description

Derive [knative_conditions::ConditionType] on your own enum to adhere to the Knative Source schema and condition management.

Automatically implements [Default] on your type, which must be the top level condition.

ยงExample

use knative_derive::ConditionType;

#[derive(ConditionType, Debug, Copy, Clone, PartialEq)]
enum MyCondition {
  // First condition must be Ready or Succeeded
  Ready,
  // Use the dependent attribute to mark conditions
  // that are required to consider the resource ready
  #[dependent]
  SinkProvided,
  #[dependent]
  Important,
  // Conditions that are not marked dependent do not
  // determine overall resource readiness
  Informational,
}