kcr_edp_epam_com 3.20260531.121040

Kubernetes Custom Resource Bindings
Documentation
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --derive=Default --derive=PartialEq --smart-derive-elision --filename crd-catalog/epam/edp-sonar-operator/edp.epam.com/v1alpha1/sonarqualitygates.yaml
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use kube::CustomResource;
    pub use serde::{Serialize, Deserialize};
    pub use std::collections::BTreeMap;
}

use self::prelude::*;

/// SonarQualityGateSpec defines the desired state of SonarQualityGate
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "edp.epam.com", version = "v1alpha1", kind = "SonarQualityGate", plural = "sonarqualitygates")]
#[kube(namespaced)]
#[kube(status = "SonarQualityGateStatus")]
#[kube(schema = "disabled")]
#[kube(derive="Default")]
#[kube(derive="PartialEq")]
pub struct SonarQualityGateSpec {
    /// Conditions is a list of conditions for quality gate.
    /// Key is a metric name, value is a condition.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub conditions: Option<BTreeMap<String, SonarQualityGateConditions>>,
    /// Default is a flag to set quality gate as default.
    /// Only one quality gate can be default.
    /// If several quality gates have default flag, the random one will be chosen.
    /// Default quality gate can't be deleted. You need to set another quality gate as default before.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub default: Option<bool>,
    /// Name is a name of quality gate.
    /// Name should be unique across all quality gates.
    /// Don't change this field after creation otherwise quality gate will be recreated.
    pub name: String,
    /// SonarRef is a reference to Sonar custom resource.
    #[serde(rename = "sonarRef")]
    pub sonar_ref: SonarQualityGateSonarRef,
}

/// Conditions is a list of conditions for quality gate.
/// Key is a metric name, value is a condition.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct SonarQualityGateConditions {
    /// Error is condition error threshold.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<String>,
    /// Op is condition operator.
    /// LT = is lower than
    /// GT = is greater than
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub op: Option<SonarQualityGateConditionsOp>,
}

/// Conditions is a list of conditions for quality gate.
/// Key is a metric name, value is a condition.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum SonarQualityGateConditionsOp {
    #[serde(rename = "LT")]
    Lt,
    #[serde(rename = "GT")]
    Gt,
}

/// SonarRef is a reference to Sonar custom resource.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct SonarQualityGateSonarRef {
    /// Kind specifies the kind of the Sonar resource.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// Name specifies the name of the Sonar resource.
    pub name: String,
}

/// SonarQualityGateStatus defines the observed state of SonarQualityGate
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct SonarQualityGateStatus {
    /// Error is an error message if something went wrong.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<String>,
    /// Value is a status of the quality gate.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
}