/*
* Artifact Keeper API
*
* Enterprise artifact registry supporting 45+ package formats.
*
* The version of the OpenAPI document: 1.2.1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// DtStatusResponse : Dependency-Track integration status surfaced to the frontend. `healthy` is the boolean the existing UI already binds to. The new `error_status` and `error_message` fields let the UI distinguish a genuine \"DT replied OK with no findings\" state from \"DT is down or misconfigured\" (issue #963). When `healthy = true` both error fields are None; when `healthy = false`: - `error_status = Some(401)`: auth failure (check API key) - `error_status = Some(5xx)`: upstream is broken - `error_status = None`: transport failure (DT pod unreachable) - `error_message`: operator-facing failure description
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DtStatusResponse {
#[serde(rename = "enabled")]
pub enabled: bool,
/// Human-readable explanation when `healthy = false`. Safe to surface in the UI; does not leak credentials.
#[serde(rename = "error_message", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub error_message: Option<Option<String>>,
/// Upstream HTTP status if the health probe got a response, else None. Only populated when `healthy = false`.
#[serde(rename = "error_status", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub error_status: Option<Option<i32>>,
#[serde(rename = "healthy")]
pub healthy: bool,
#[serde(rename = "url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub url: Option<Option<String>>,
}
impl DtStatusResponse {
/// Dependency-Track integration status surfaced to the frontend. `healthy` is the boolean the existing UI already binds to. The new `error_status` and `error_message` fields let the UI distinguish a genuine \"DT replied OK with no findings\" state from \"DT is down or misconfigured\" (issue #963). When `healthy = true` both error fields are None; when `healthy = false`: - `error_status = Some(401)`: auth failure (check API key) - `error_status = Some(5xx)`: upstream is broken - `error_status = None`: transport failure (DT pod unreachable) - `error_message`: operator-facing failure description
pub fn new(enabled: bool, healthy: bool) -> DtStatusResponse {
DtStatusResponse {
enabled,
error_message: None,
error_status: None,
healthy,
url: None,
}
}
}