k8s_openapi/v1_35/apimachinery/pkg/apis/meta/v1/
list_meta.rs

1// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta
2
3/// ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct ListMeta {
6    /// continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.
7    pub continue_: Option<std::string::String>,
8
9    /// remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.
10    pub remaining_item_count: Option<i64>,
11
12    /// String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency
13    pub resource_version: Option<std::string::String>,
14
15    /// Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.
16    pub self_link: Option<std::string::String>,
17}
18
19impl crate::DeepMerge for ListMeta {
20    fn merge_from(&mut self, other: Self) {
21        crate::DeepMerge::merge_from(&mut self.continue_, other.continue_);
22        crate::DeepMerge::merge_from(&mut self.remaining_item_count, other.remaining_item_count);
23        crate::DeepMerge::merge_from(&mut self.resource_version, other.resource_version);
24        crate::DeepMerge::merge_from(&mut self.self_link, other.self_link);
25    }
26}
27
28impl<'de> crate::serde::Deserialize<'de> for ListMeta {
29    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
30        #[allow(non_camel_case_types)]
31        enum Field {
32            Key_continue_,
33            Key_remaining_item_count,
34            Key_resource_version,
35            Key_self_link,
36            Other,
37        }
38
39        impl<'de> crate::serde::Deserialize<'de> for Field {
40            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
41                struct Visitor;
42
43                impl crate::serde::de::Visitor<'_> for Visitor {
44                    type Value = Field;
45
46                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
47                        f.write_str("field identifier")
48                    }
49
50                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
51                        Ok(match v {
52                            "continue" => Field::Key_continue_,
53                            "remainingItemCount" => Field::Key_remaining_item_count,
54                            "resourceVersion" => Field::Key_resource_version,
55                            "selfLink" => Field::Key_self_link,
56                            _ => Field::Other,
57                        })
58                    }
59                }
60
61                deserializer.deserialize_identifier(Visitor)
62            }
63        }
64
65        struct Visitor;
66
67        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
68            type Value = ListMeta;
69
70            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
71                f.write_str("ListMeta")
72            }
73
74            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
75                let mut value_continue_: Option<std::string::String> = None;
76                let mut value_remaining_item_count: Option<i64> = None;
77                let mut value_resource_version: Option<std::string::String> = None;
78                let mut value_self_link: Option<std::string::String> = None;
79
80                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
81                    match key {
82                        Field::Key_continue_ => value_continue_ = crate::serde::de::MapAccess::next_value(&mut map)?,
83                        Field::Key_remaining_item_count => value_remaining_item_count = crate::serde::de::MapAccess::next_value(&mut map)?,
84                        Field::Key_resource_version => value_resource_version = crate::serde::de::MapAccess::next_value(&mut map)?,
85                        Field::Key_self_link => value_self_link = crate::serde::de::MapAccess::next_value(&mut map)?,
86                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
87                    }
88                }
89
90                Ok(ListMeta {
91                    continue_: value_continue_,
92                    remaining_item_count: value_remaining_item_count,
93                    resource_version: value_resource_version,
94                    self_link: value_self_link,
95                })
96            }
97        }
98
99        deserializer.deserialize_struct(
100            "ListMeta",
101            &[
102                "continue",
103                "remainingItemCount",
104                "resourceVersion",
105                "selfLink",
106            ],
107            Visitor,
108        )
109    }
110}
111
112impl crate::serde::Serialize for ListMeta {
113    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
114        let mut state = serializer.serialize_struct(
115            "ListMeta",
116            self.continue_.as_ref().map_or(0, |_| 1) +
117            self.remaining_item_count.as_ref().map_or(0, |_| 1) +
118            self.resource_version.as_ref().map_or(0, |_| 1) +
119            self.self_link.as_ref().map_or(0, |_| 1),
120        )?;
121        if let Some(value) = &self.continue_ {
122            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "continue", value)?;
123        }
124        if let Some(value) = &self.remaining_item_count {
125            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "remainingItemCount", value)?;
126        }
127        if let Some(value) = &self.resource_version {
128            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "resourceVersion", value)?;
129        }
130        if let Some(value) = &self.self_link {
131            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "selfLink", value)?;
132        }
133        crate::serde::ser::SerializeStruct::end(state)
134    }
135}
136
137#[cfg(feature = "schemars")]
138impl crate::schemars::JsonSchema for ListMeta {
139    fn schema_name() -> std::borrow::Cow<'static, str> {
140        "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta".into()
141    }
142
143    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
144        crate::schemars::json_schema!({
145            "description": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
146            "type": "object",
147            "properties": {
148                "continue": {
149                    "description": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.",
150                    "type": "string",
151                },
152                "remainingItemCount": {
153                    "description": "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.",
154                    "type": "integer",
155                    "format": "int64",
156                },
157                "resourceVersion": {
158                    "description": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
159                    "type": "string",
160                },
161                "selfLink": {
162                    "description": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.",
163                    "type": "string",
164                },
165            },
166        })
167    }
168}