k8s_openapi/v1_36/api/resource/v1alpha3/
resource_pool_status_request.rs1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct ResourcePoolStatusRequest {
6 pub metadata: crate::apimachinery::pkg::apis::meta::v1::ObjectMeta,
8
9 pub spec: crate::api::resource::v1alpha3::ResourcePoolStatusRequestSpec,
11
12 pub status: Option<crate::api::resource::v1alpha3::ResourcePoolStatusRequestStatus>,
14}
15
16impl crate::Resource for ResourcePoolStatusRequest {
17 const API_VERSION: &'static str = "resource.k8s.io/v1alpha3";
18 const GROUP: &'static str = "resource.k8s.io";
19 const KIND: &'static str = "ResourcePoolStatusRequest";
20 const VERSION: &'static str = "v1alpha3";
21 const URL_PATH_SEGMENT: &'static str = "resourcepoolstatusrequests";
22 type Scope = crate::ClusterResourceScope;
23}
24
25impl crate::ListableResource for ResourcePoolStatusRequest {
26 const LIST_KIND: &'static str = "ResourcePoolStatusRequestList";
27}
28
29impl crate::Metadata for ResourcePoolStatusRequest {
30 type Ty = crate::apimachinery::pkg::apis::meta::v1::ObjectMeta;
31
32 fn metadata(&self) -> &<Self as crate::Metadata>::Ty {
33 &self.metadata
34 }
35
36 fn metadata_mut(&mut self) -> &mut<Self as crate::Metadata>::Ty {
37 &mut self.metadata
38 }
39}
40
41impl crate::DeepMerge for ResourcePoolStatusRequest {
42 fn merge_from(&mut self, other: Self) {
43 crate::DeepMerge::merge_from(&mut self.metadata, other.metadata);
44 crate::DeepMerge::merge_from(&mut self.spec, other.spec);
45 crate::DeepMerge::merge_from(&mut self.status, other.status);
46 }
47}
48
49impl<'de> crate::serde::Deserialize<'de> for ResourcePoolStatusRequest {
50 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
51 #[allow(non_camel_case_types)]
52 enum Field {
53 Key_api_version,
54 Key_kind,
55 Key_metadata,
56 Key_spec,
57 Key_status,
58 Other,
59 }
60
61 impl<'de> crate::serde::Deserialize<'de> for Field {
62 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
63 struct Visitor;
64
65 impl crate::serde::de::Visitor<'_> for Visitor {
66 type Value = Field;
67
68 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
69 f.write_str("field identifier")
70 }
71
72 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
73 Ok(match v {
74 "apiVersion" => Field::Key_api_version,
75 "kind" => Field::Key_kind,
76 "metadata" => Field::Key_metadata,
77 "spec" => Field::Key_spec,
78 "status" => Field::Key_status,
79 _ => Field::Other,
80 })
81 }
82 }
83
84 deserializer.deserialize_identifier(Visitor)
85 }
86 }
87
88 struct Visitor;
89
90 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
91 type Value = ResourcePoolStatusRequest;
92
93 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
94 f.write_str(<Self::Value as crate::Resource>::KIND)
95 }
96
97 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
98 let mut value_metadata: Option<crate::apimachinery::pkg::apis::meta::v1::ObjectMeta> = None;
99 let mut value_spec: Option<crate::api::resource::v1alpha3::ResourcePoolStatusRequestSpec> = None;
100 let mut value_status: Option<crate::api::resource::v1alpha3::ResourcePoolStatusRequestStatus> = None;
101
102 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
103 match key {
104 Field::Key_api_version => {
105 let value_api_version: std::string::String = crate::serde::de::MapAccess::next_value(&mut map)?;
106 if value_api_version != <Self::Value as crate::Resource>::API_VERSION {
107 return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_api_version), &<Self::Value as crate::Resource>::API_VERSION));
108 }
109 },
110 Field::Key_kind => {
111 let value_kind: std::string::String = crate::serde::de::MapAccess::next_value(&mut map)?;
112 if value_kind != <Self::Value as crate::Resource>::KIND {
113 return Err(crate::serde::de::Error::invalid_value(crate::serde::de::Unexpected::Str(&value_kind), &<Self::Value as crate::Resource>::KIND));
114 }
115 },
116 Field::Key_metadata => value_metadata = crate::serde::de::MapAccess::next_value(&mut map)?,
117 Field::Key_spec => value_spec = crate::serde::de::MapAccess::next_value(&mut map)?,
118 Field::Key_status => value_status = crate::serde::de::MapAccess::next_value(&mut map)?,
119 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
120 }
121 }
122
123 Ok(ResourcePoolStatusRequest {
124 metadata: value_metadata.unwrap_or_default(),
125 spec: value_spec.unwrap_or_default(),
126 status: value_status,
127 })
128 }
129 }
130
131 deserializer.deserialize_struct(
132 <Self as crate::Resource>::KIND,
133 &[
134 "apiVersion",
135 "kind",
136 "metadata",
137 "spec",
138 "status",
139 ],
140 Visitor,
141 )
142 }
143}
144
145impl crate::serde::Serialize for ResourcePoolStatusRequest {
146 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
147 let mut state = serializer.serialize_struct(
148 <Self as crate::Resource>::KIND,
149 4 +
150 self.status.as_ref().map_or(0, |_| 1),
151 )?;
152 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", <Self as crate::Resource>::API_VERSION)?;
153 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", <Self as crate::Resource>::KIND)?;
154 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "metadata", &self.metadata)?;
155 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "spec", &self.spec)?;
156 if let Some(value) = &self.status {
157 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "status", value)?;
158 }
159 crate::serde::ser::SerializeStruct::end(state)
160 }
161}
162
163#[cfg(feature = "schemars")]
164impl crate::schemars::JsonSchema for ResourcePoolStatusRequest {
165 fn schema_name() -> std::borrow::Cow<'static, str> {
166 "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest".into()
167 }
168
169 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
170 crate::schemars::json_schema!({
171 "description": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.",
172 "type": "object",
173 "properties": {
174 "apiVersion": {
175 "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
176 "type": "string",
177 },
178 "kind": {
179 "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
180 "type": "string",
181 },
182 "metadata": ({
183 let mut schema_obj = __gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::ObjectMeta>();
184 schema_obj.ensure_object().insert("description".into(), "Standard object metadata".into());
185 schema_obj
186 }),
187 "spec": ({
188 let mut schema_obj = __gen.subschema_for::<crate::api::resource::v1alpha3::ResourcePoolStatusRequestSpec>();
189 schema_obj.ensure_object().insert("description".into(), "Spec defines the filters for which pools to include in the status. The spec is immutable once created.".into());
190 schema_obj
191 }),
192 "status": ({
193 let mut schema_obj = __gen.subschema_for::<crate::api::resource::v1alpha3::ResourcePoolStatusRequestStatus>();
194 schema_obj.ensure_object().insert("description".into(), "Status is populated by the controller with the calculated pool status. When status is non-nil, the request is considered complete and the entire object becomes immutable.".into());
195 schema_obj
196 }),
197 },
198 "required": [
199 "metadata",
200 "spec",
201 ],
202 })
203 }
204}
205
206#[cfg(feature = "schemars08")]
207impl crate::schemars08::JsonSchema for ResourcePoolStatusRequest {
208 fn schema_name() -> std::string::String {
209 "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest".into()
210 }
211
212 fn json_schema(__gen: &mut crate::schemars08::gen::SchemaGenerator) -> crate::schemars08::schema::Schema {
213 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
214 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
215 description: Some("ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.".into()),
216 ..Default::default()
217 })),
218 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
219 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
220 properties: [
221 (
222 "apiVersion".into(),
223 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
224 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
225 description: Some("APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources".into()),
226 ..Default::default()
227 })),
228 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
229 ..Default::default()
230 }),
231 ),
232 (
233 "kind".into(),
234 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
235 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
236 description: Some("Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".into()),
237 ..Default::default()
238 })),
239 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
240 ..Default::default()
241 }),
242 ),
243 (
244 "metadata".into(),
245 {
246 let mut schema_obj = __gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::ObjectMeta>().into_object();
247 schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
248 description: Some("Standard object metadata".into()),
249 ..Default::default()
250 }));
251 crate::schemars08::schema::Schema::Object(schema_obj)
252 },
253 ),
254 (
255 "spec".into(),
256 {
257 let mut schema_obj = __gen.subschema_for::<crate::api::resource::v1alpha3::ResourcePoolStatusRequestSpec>().into_object();
258 schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
259 description: Some("Spec defines the filters for which pools to include in the status. The spec is immutable once created.".into()),
260 ..Default::default()
261 }));
262 crate::schemars08::schema::Schema::Object(schema_obj)
263 },
264 ),
265 (
266 "status".into(),
267 {
268 let mut schema_obj = __gen.subschema_for::<crate::api::resource::v1alpha3::ResourcePoolStatusRequestStatus>().into_object();
269 schema_obj.metadata = Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
270 description: Some("Status is populated by the controller with the calculated pool status. When status is non-nil, the request is considered complete and the entire object becomes immutable.".into()),
271 ..Default::default()
272 }));
273 crate::schemars08::schema::Schema::Object(schema_obj)
274 },
275 ),
276 ].into(),
277 required: [
278 "metadata".into(),
279 "spec".into(),
280 ].into(),
281 ..Default::default()
282 })),
283 ..Default::default()
284 })
285 }
286}