#
k8s_openapi/v1_35/apimachinery/pkg/apis/meta/v1/
status_details.rs

    1// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails
    2
    3/// StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.
    4#[derive(Clone, Debug, Default, PartialEq)]
    5pub struct StatusDetails {
    6    /// The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.
    7    pub causes: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::StatusCause>>,
    8
    9    /// The group attribute of the resource associated with the status StatusReason.
    10    pub group: Option<std::string::String>,
    11
    12    /// The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    13    pub kind: Option<std::string::String>,
    14
    15    /// The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).
    16    pub name: Option<std::string::String>,
    17
    18    /// If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.
    19    pub retry_after_seconds: Option<i32>,
    20
    21    /// UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
    22    pub uid: Option<std::string::String>,
    23}
    24
    25impl crate::DeepMerge for StatusDetails {
    26    fn merge_from(&mut self, other: Self) {
    27        crate::merge_strategies::list::atomic(&mut self.causes, other.causes);
    28        crate::DeepMerge::merge_from(&mut self.group, other.group);
    29        crate::DeepMerge::merge_from(&mut self.kind, other.kind);
    30        crate::DeepMerge::merge_from(&mut self.name, other.name);
    31        crate::DeepMerge::merge_from(&mut self.retry_after_seconds, other.retry_after_seconds);
    32        crate::DeepMerge::merge_from(&mut self.uid, other.uid);
    33    }
    34}
    35
    36impl<'de> crate::serde::Deserialize<'de> for StatusDetails {
    37    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
    38        #[allow(non_camel_case_types)]
    39        enum Field {
    40            Key_causes,
    41            Key_group,
    42            Key_kind,
    43            Key_name,
    44            Key_retry_after_seconds,
    45            Key_uid,
    46            Other,
    47        }
    48
    49        impl<'de> crate::serde::Deserialize<'de> for Field {
    50            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
    51                struct Visitor;
    52
    53                impl crate::serde::de::Visitor<'_> for Visitor {
    54                    type Value = Field;
    55
    56                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    57                        f.write_str("field identifier")
    58                    }
    59
    60                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
    61                        Ok(match v {
    62                            "causes" => Field::Key_causes,
    63                            "group" => Field::Key_group,
    64                            "kind" => Field::Key_kind,
    65                            "name" => Field::Key_name,
    66                            "retryAfterSeconds" => Field::Key_retry_after_seconds,
    67                            "uid" => Field::Key_uid,
    68                            _ => Field::Other,
    69                        })
    70                    }
    71                }
    72
    73                deserializer.deserialize_identifier(Visitor)
    74            }
    75        }
    76
    77        struct Visitor;
    78
    79        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
    80            type Value = StatusDetails;
    81
    82            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    83                f.write_str("StatusDetails")
    84            }
    85
    86            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
    87                let mut value_causes: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::StatusCause>> = None;
    88                let mut value_group: Option<std::string::String> = None;
    89                let mut value_kind: Option<std::string::String> = None;
    90                let mut value_name: Option<std::string::String> = None;
    91                let mut value_retry_after_seconds: Option<i32> = None;
    92                let mut value_uid: Option<std::string::String> = None;
    93
    94                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
    95                    match key {
    96                        Field::Key_causes => value_causes = crate::serde::de::MapAccess::next_value(&mut map)?,
    97                        Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?,
    98                        Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?,
    99                        Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?,
    100                        Field::Key_retry_after_seconds => value_retry_after_seconds = crate::serde::de::MapAccess::next_value(&mut map)?,
    101                        Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?,
    102                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
    103                    }
    104                }
    105
    106                Ok(StatusDetails {
    107                    causes: value_causes,
    108                    group: value_group,
    109                    kind: value_kind,
    110                    name: value_name,
    111                    retry_after_seconds: value_retry_after_seconds,
    112                    uid: value_uid,
    113                })
    114            }
    115        }
    116
    117        deserializer.deserialize_struct(
    118            "StatusDetails",
    119            &[
    120                "causes",
    121                "group",
    122                "kind",
    123                "name",
    124                "retryAfterSeconds",
    125                "uid",
    126            ],
    127            Visitor,
    128        )
    129    }
    130}
    131
    132impl crate::serde::Serialize for StatusDetails {
    133    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
    134        let mut state = serializer.serialize_struct(
    135            "StatusDetails",
    136            self.causes.as_ref().map_or(0, |_| 1) +
    137            self.group.as_ref().map_or(0, |_| 1) +
    138            self.kind.as_ref().map_or(0, |_| 1) +
    139            self.name.as_ref().map_or(0, |_| 1) +
    140            self.retry_after_seconds.as_ref().map_or(0, |_| 1) +
    141            self.uid.as_ref().map_or(0, |_| 1),
    142        )?;
    143        if let Some(value) = &self.causes {
    144            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "causes", value)?;
    145        }
    146        if let Some(value) = &self.group {
    147            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?;
    148        }
    149        if let Some(value) = &self.kind {
    150            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?;
    151        }
    152        if let Some(value) = &self.name {
    153            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?;
    154        }
    155        if let Some(value) = &self.retry_after_seconds {
    156            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "retryAfterSeconds", value)?;
    157        }
    158        if let Some(value) = &self.uid {
    159            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?;
    160        }
    161        crate::serde::ser::SerializeStruct::end(state)
    162    }
    163}
    164
    165#[cfg(feature = "schemars")]
    166impl crate::schemars::JsonSchema for StatusDetails {
    167    fn schema_name() -> std::borrow::Cow<'static, str> {
    168        "io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails".into()
    169    }
    170
    171    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
    172        crate::schemars::json_schema!({
    173            "description": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
    174            "type": "object",
    175            "properties": {
    176                "causes": {
    177                    "description": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
    178                    "type": "array",
    179                    "items": (__gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::StatusCause>()),
    180                },
    181                "group": {
    182                    "description": "The group attribute of the resource associated with the status StatusReason.",
    183                    "type": "string",
    184                },
    185                "kind": {
    186                    "description": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
    187                    "type": "string",
    188                },
    189                "name": {
    190                    "description": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
    191                    "type": "string",
    192                },
    193                "retryAfterSeconds": {
    194                    "description": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.",
    195                    "type": "integer",
    196                    "format": "int32",
    197                },
    198                "uid": {
    199                    "description": "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
    200                    "type": "string",
    201                },
    202            },
    203        })
    204    }
    205}