k8s_openapi/v1_35/kube_aggregator/pkg/apis/apiregistration/v1/
api_service_spec.rs

1// Generated from definition io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceSpec
2
3/// APIServiceSpec contains information for locating and communicating with a server. Only https is supported, though you are able to disable certificate verification.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct APIServiceSpec {
6    /// CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. If unspecified, system trust roots on the apiserver are used.
7    pub ca_bundle: Option<crate::ByteString>,
8
9    /// Group is the API group name this server hosts
10    pub group: Option<std::string::String>,
11
12    /// GroupPriorityMinimum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMinimum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object.  (v1.bar before v1.foo) We'd recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000s
13    pub group_priority_minimum: i32,
14
15    /// InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged.  You should use the CABundle instead.
16    pub insecure_skip_tls_verify: Option<bool>,
17
18    /// Service is a reference to the service for this API server.  It must communicate on port 443. If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be fulfilled.
19    pub service: Option<crate::kube_aggregator::pkg::apis::apiregistration::v1::ServiceReference>,
20
21    /// Version is the API version this server hosts.  For example, "v1"
22    pub version: Option<std::string::String>,
23
24    /// VersionPriority controls the ordering of this API version inside of its group.  Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). Since it's inside of a group, the number can be small, probably in the 10s. In case of equal version priorities, the version string will be used to compute the order inside a group. If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first by GA \> beta \> alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.
25    pub version_priority: i32,
26}
27
28impl crate::DeepMerge for APIServiceSpec {
29    fn merge_from(&mut self, other: Self) {
30        crate::DeepMerge::merge_from(&mut self.ca_bundle, other.ca_bundle);
31        crate::DeepMerge::merge_from(&mut self.group, other.group);
32        crate::DeepMerge::merge_from(&mut self.group_priority_minimum, other.group_priority_minimum);
33        crate::DeepMerge::merge_from(&mut self.insecure_skip_tls_verify, other.insecure_skip_tls_verify);
34        crate::DeepMerge::merge_from(&mut self.service, other.service);
35        crate::DeepMerge::merge_from(&mut self.version, other.version);
36        crate::DeepMerge::merge_from(&mut self.version_priority, other.version_priority);
37    }
38}
39
40impl<'de> crate::serde::Deserialize<'de> for APIServiceSpec {
41    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
42        #[allow(non_camel_case_types)]
43        enum Field {
44            Key_ca_bundle,
45            Key_group,
46            Key_group_priority_minimum,
47            Key_insecure_skip_tls_verify,
48            Key_service,
49            Key_version,
50            Key_version_priority,
51            Other,
52        }
53
54        impl<'de> crate::serde::Deserialize<'de> for Field {
55            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
56                struct Visitor;
57
58                impl crate::serde::de::Visitor<'_> for Visitor {
59                    type Value = Field;
60
61                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
62                        f.write_str("field identifier")
63                    }
64
65                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
66                        Ok(match v {
67                            "caBundle" => Field::Key_ca_bundle,
68                            "group" => Field::Key_group,
69                            "groupPriorityMinimum" => Field::Key_group_priority_minimum,
70                            "insecureSkipTLSVerify" => Field::Key_insecure_skip_tls_verify,
71                            "service" => Field::Key_service,
72                            "version" => Field::Key_version,
73                            "versionPriority" => Field::Key_version_priority,
74                            _ => Field::Other,
75                        })
76                    }
77                }
78
79                deserializer.deserialize_identifier(Visitor)
80            }
81        }
82
83        struct Visitor;
84
85        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
86            type Value = APIServiceSpec;
87
88            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
89                f.write_str("APIServiceSpec")
90            }
91
92            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
93                let mut value_ca_bundle: Option<crate::ByteString> = None;
94                let mut value_group: Option<std::string::String> = None;
95                let mut value_group_priority_minimum: Option<i32> = None;
96                let mut value_insecure_skip_tls_verify: Option<bool> = None;
97                let mut value_service: Option<crate::kube_aggregator::pkg::apis::apiregistration::v1::ServiceReference> = None;
98                let mut value_version: Option<std::string::String> = None;
99                let mut value_version_priority: Option<i32> = None;
100
101                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
102                    match key {
103                        Field::Key_ca_bundle => value_ca_bundle = crate::serde::de::MapAccess::next_value(&mut map)?,
104                        Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?,
105                        Field::Key_group_priority_minimum => value_group_priority_minimum = crate::serde::de::MapAccess::next_value(&mut map)?,
106                        Field::Key_insecure_skip_tls_verify => value_insecure_skip_tls_verify = crate::serde::de::MapAccess::next_value(&mut map)?,
107                        Field::Key_service => value_service = crate::serde::de::MapAccess::next_value(&mut map)?,
108                        Field::Key_version => value_version = crate::serde::de::MapAccess::next_value(&mut map)?,
109                        Field::Key_version_priority => value_version_priority = crate::serde::de::MapAccess::next_value(&mut map)?,
110                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
111                    }
112                }
113
114                Ok(APIServiceSpec {
115                    ca_bundle: value_ca_bundle,
116                    group: value_group,
117                    group_priority_minimum: value_group_priority_minimum.unwrap_or_default(),
118                    insecure_skip_tls_verify: value_insecure_skip_tls_verify,
119                    service: value_service,
120                    version: value_version,
121                    version_priority: value_version_priority.unwrap_or_default(),
122                })
123            }
124        }
125
126        deserializer.deserialize_struct(
127            "APIServiceSpec",
128            &[
129                "caBundle",
130                "group",
131                "groupPriorityMinimum",
132                "insecureSkipTLSVerify",
133                "service",
134                "version",
135                "versionPriority",
136            ],
137            Visitor,
138        )
139    }
140}
141
142impl crate::serde::Serialize for APIServiceSpec {
143    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
144        let mut state = serializer.serialize_struct(
145            "APIServiceSpec",
146            2 +
147            self.ca_bundle.as_ref().map_or(0, |_| 1) +
148            self.group.as_ref().map_or(0, |_| 1) +
149            self.insecure_skip_tls_verify.as_ref().map_or(0, |_| 1) +
150            self.service.as_ref().map_or(0, |_| 1) +
151            self.version.as_ref().map_or(0, |_| 1),
152        )?;
153        if let Some(value) = &self.ca_bundle {
154            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "caBundle", value)?;
155        }
156        if let Some(value) = &self.group {
157            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?;
158        }
159        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "groupPriorityMinimum", &self.group_priority_minimum)?;
160        if let Some(value) = &self.insecure_skip_tls_verify {
161            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "insecureSkipTLSVerify", value)?;
162        }
163        if let Some(value) = &self.service {
164            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "service", value)?;
165        }
166        if let Some(value) = &self.version {
167            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "version", value)?;
168        }
169        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "versionPriority", &self.version_priority)?;
170        crate::serde::ser::SerializeStruct::end(state)
171    }
172}
173
174#[cfg(feature = "schemars")]
175impl crate::schemars::JsonSchema for APIServiceSpec {
176    fn schema_name() -> std::borrow::Cow<'static, str> {
177        "io.k8s.kube-aggregator.pkg.apis.apiregistration.v1.APIServiceSpec".into()
178    }
179
180    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
181        crate::schemars::json_schema!({
182            "description": "APIServiceSpec contains information for locating and communicating with a server. Only https is supported, though you are able to disable certificate verification.",
183            "type": "object",
184            "properties": {
185                "caBundle": {
186                    "description": "CABundle is a PEM encoded CA bundle which will be used to validate an API server's serving certificate. If unspecified, system trust roots on the apiserver are used.",
187                    "type": "string",
188                    "format": "byte",
189                },
190                "group": {
191                    "description": "Group is the API group name this server hosts",
192                    "type": "string",
193                },
194                "groupPriorityMinimum": {
195                    "description": "GroupPriorityMinimum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMinimum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object.  (v1.bar before v1.foo) We'd recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000s",
196                    "type": "integer",
197                    "format": "int32",
198                },
199                "insecureSkipTLSVerify": {
200                    "description": "InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged.  You should use the CABundle instead.",
201                    "type": "boolean",
202                },
203                "service": ({
204                    let mut schema_obj = __gen.subschema_for::<crate::kube_aggregator::pkg::apis::apiregistration::v1::ServiceReference>();
205                    schema_obj.ensure_object().insert("description".into(), "Service is a reference to the service for this API server.  It must communicate on port 443. If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be fulfilled.".into());
206                    schema_obj
207                }),
208                "version": {
209                    "description": "Version is the API version this server hosts.  For example, \"v1\"",
210                    "type": "string",
211                },
212                "versionPriority": {
213                    "description": "VersionPriority controls the ordering of this API version inside of its group.  Must be greater than zero. The primary sort is based on VersionPriority, ordered highest to lowest (20 before 10). Since it's inside of a group, the number can be small, probably in the 10s. In case of equal version priorities, the version string will be used to compute the order inside a group. If the version string is \"kube-like\", it will sort above non \"kube-like\" version strings, which are ordered lexicographically. \"Kube-like\" versions start with a \"v\", then are followed by a number (the major version), then optionally the string \"alpha\" or \"beta\" and another number (the minor version). These are sorted first by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.",
214                    "type": "integer",
215                    "format": "int32",
216                },
217            },
218            "required": [
219                "groupPriorityMinimum",
220                "versionPriority",
221            ],
222        })
223    }
224}